码迷,mamicode.com
首页 >  
搜索关键字:smallest sub-array    ( 590个结果
【优先队列】【UVa11997】K Smallest Sums
传送门 Description Input Output Translation · 给定k个长度为k的数组,把每个数组选一个元素加起来,这样共有kk种可能的答案,求最小的k个 Sample Input Sample Output Hint k<=750 Solution 显然可以一行一行做,同时如 ...
分类:其他好文   时间:2018-08-01 12:12:36    阅读次数:144
First Missing Positive
1.题目 === Given an unsorted integer array, find the smallest missing positive integer. Note: Your algorithm should run in O(n) time and uses constant e ...
分类:其他好文   时间:2018-07-28 22:23:09    阅读次数:152
To the Max
题目描述 Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater located withi ...
分类:其他好文   时间:2018-07-16 17:16:46    阅读次数:177
Leetcode 865. Smallest Subtree with all the Deepest Nodes
这道题的关键在于知道每个节点的深度,可以用哈希表保存的前提下,怎么找出公共最小的父节点。方法是,如果当前node左右节点都有深度最大节点,返回当前node,如果只有左边有,返回node的左节点,反之返回右节点。也就是以下的java代码 public TreeNode answer(TreeNode ...
分类:其他好文   时间:2018-07-15 22:14:44    阅读次数:134
poj1050 dp动态规划
Description Given a two-dimensional array of positive and negative integers, a sub-rectangle is any contiguous sub-array of size 1*1 or greater locate ...
分类:其他好文   时间:2018-07-15 19:35:55    阅读次数:212
【leetcode】Weekly Contest 92
emm,两天打的周赛,万年三题qaq,不过这次题目好像比上次的难一丢丢。 1.Transpose Matrix 把矩阵A[i][j]的每个元素改成B[j][i],超级超级大水题,然后wa了两发qaq。 2. Smallest Subtree with all the Deepest Nodes 一开 ...
分类:其他好文   时间:2018-07-10 21:38:39    阅读次数:175
866. Smallest Subtree with all the Deepest Nodes
Given a binary tree rooted at root, the depth of each node is the shortest distance to the root. A node is deepest if it has the largest depth possibl ...
分类:其他好文   时间:2018-07-10 17:52:45    阅读次数:176
[LeetCode] Smallest Rotation with Highest Score 得到最高分的最小旋转
Given an array A, we may rotate it by a non-negative integer K so that the array becomes A[K], A[K+1], A{K+2], ... A[A.length - 1], A[0], A[1], ..., A ...
分类:其他好文   时间:2018-07-06 13:10:10    阅读次数:253
[Atcoder Code Festival 2017 Qual B Problem F]Largest Smallest Cyclic Shift
题目大意:给你\(A\)个a,\(B\)个b,\(C\)个c,要你构造一个字符串,使它的最小循环表示法最大。求这个表示法。解题思路:不知道怎么证,但把a、b、c当做单独的字符串扔进容器,每次把字典序最小的和字典序最大的两个字符串合并就是答案。容器用multiset即可。 C++ Code: ...
分类:其他好文   时间:2018-07-05 19:58:00    阅读次数:201
373. Find K Pairs with Smallest Sums
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from th ...
分类:其他好文   时间:2018-07-03 14:54:45    阅读次数:247
590条   上一页 1 ... 13 14 15 16 17 ... 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!