码迷,mamicode.com
首页 >  
搜索关键字:smallest sub-array    ( 590个结果
[LeetCode] 230. Kth Smallest Element in a BST 解题思路
问题:找出二叉搜索树种第 k 小的元素。 一个深度遍历的应用。使用递归、或者借助栈都可以实现深度遍历。本文代码使用递归实现。
分类:其他好文   时间:2016-01-10 11:35:01    阅读次数:154
uva 11536 - Smallest Sub-Array
题目大意:按照题目中的要求构造出一个序列,找出最短的子序列,包含1~k。解题思路:先根据题目的方法构造出序列,然后用Towpointer的方法,用v[i]来记录当前[l, r]中有几个i;当r移动时,出现v[i] == 1时, c++(用来记录有几个1~k的数字);当c == k 时,就要移动l,当...
分类:其他好文   时间:2016-01-10 00:18:18    阅读次数:183
Lintcode: Minimum Subarray
Given an array of integers, find the subarray with smallest sum.Return the sum of the subarray.Have you met this question in a real interview? YesExam...
分类:其他好文   时间:2016-01-09 07:32:10    阅读次数:164
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) co...
分类:其他好文   时间:2016-01-09 06:17:21    阅读次数:119
SQL-Delete Duplicate Emails
Write a SQL query to delete all duplicate email entries in a table named Person, keeping only unique emails based on its smallest Id.+----+-----------...
分类:数据库   时间:2016-01-02 22:20:38    阅读次数:202
Leetcode: 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...
分类:其他好文   时间:2015-12-29 08:45:18    阅读次数:133
Bitwise Equations
Problem DescriptionYou are given two positive integers X and K. Return the K-th smallest positive integer Y, for which the following equation holds: X...
分类:其他好文   时间:2015-12-26 18:28:49    阅读次数:165
uva 11997 K Smallest Sums 优先队列处理多路归并问题
题意:K个数组每组K个值,每次从一组中选一个,共K^k种,问前K个小的。思路:优先队列处理多路归并,每个状态含有K个元素。详见刘汝佳算法指南。 1 #include 2 #include 3 #include 4 #include 5 #include 6 #include 7 #include 8...
分类:其他好文   时间:2015-12-25 18:42:11    阅读次数:198
工作中常用命令
sed -n '21592,23591p' logperl -pi -e 's/str1/str2/g' logprstat -s size -n 10prstat -s cpu -n 10ls -lR | sort -bn +4 (smallest to largest)ls -lR | sort...
分类:其他好文   时间:2015-12-24 10:33:08    阅读次数:172
Leetcode: Kth Smallest Element in a BST
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it.Note: You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:其他好文   时间:2015-12-19 13:44:38    阅读次数:163
590条   上一页 1 ... 35 36 37 38 39 ... 59 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!