码迷,mamicode.com
首页 >  
搜索关键字:smallest sub-array    ( 590个结果
Leetcode: Find K Pairs with Smallest Sums
Better Solution: O(KlogK), 转自https://discuss.leetcode.com/topic/50885/simple-java-o-klogk-solution-with-explanation Naive Solution: 就是没有利用每个数组都是sorted ...
分类:其他好文   时间:2016-11-28 09:29:26    阅读次数:183
[LintCode] Min Stack 最小栈
Implement a stack with min() function, which will return the smallest number in the stack. It should support push, pop and min operation all in O(1) c ...
分类:其他好文   时间:2016-11-14 07:50:37    阅读次数:280
[LeetCode] K-th Smallest in Lexicographical Order 字典顺序的第K小数字
Given integers n and k, find the lexicographically k-th smallest integer in the range from 1 to n. Note: 1 ≤ k ≤ n ≤ 109. Example: s 类似题目: Lexicograph ...
分类:其他好文   时间:2016-11-04 23:06:21    阅读次数:191
Leetcode:378. Kth Smallest Element in a Sorted Matrix
题目: Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it i ...
分类:其他好文   时间:2016-11-02 17:17:55    阅读次数:156
378. Kth Smallest Element in a Sorted Matrix
和merge k sorted linked list是一样的,不同就是自己要打一个包建一个类,然后建一个pq 时间复杂度是O(klogn). n = matrix.length ...
分类:其他好文   时间:2016-10-24 09:42:13    阅读次数:257
Smallest Rectangle Enclosing Black Pixels
An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one bla ...
分类:其他好文   时间:2016-10-15 13:38:57    阅读次数:124
UVA.11997- K Smallest Sums, OJ4TH.368 - Magry's Sum I
感谢算法助教们给了这么一个好题... 题意: 给出n个数组,每个数组有n个元素,我们从每个数组中挑选一个元素,共计n个元素求和,得到共计 $ k^k $ 种sum,求sum中的最小n个值。 思路1代码: 1 #include<cstdio> 2 #include<iostream> 3 #inclu ...
分类:其他好文   时间:2016-10-12 19:01:50    阅读次数:340
[LeetCode] Remove K Digits 去掉K位数字
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l ...
分类:其他好文   时间:2016-09-19 06:44:24    阅读次数:133
Minimum Subarray
Given an array of integers, find the subarray with smallest sum. Return the sum of the subarray. Notice The subarray should contain one integer at lea ...
分类:其他好文   时间:2016-09-12 14:02:29    阅读次数:152
POJ 2718 Smallest Difference
Smallest Difference Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 8463 Accepted: 2324 Description Given a number of distinct decimal digi ...
分类:其他好文   时间:2016-09-09 10:20:24    阅读次数:164
590条   上一页 1 ... 27 28 29 30 31 ... 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!