码迷,mamicode.com
首页 >  
搜索关键字:kth smallest element    ( 12839个结果
Pascal's Triangle II Leetcode java
题目:Given an index k, return the kth row of the Pascal's triangle.For example, given k = 3,Return [1,3,3,1].Note:Could you optimize your algorithm to ....
分类:编程语言   时间:2014-08-03 05:24:06    阅读次数:304
【代码优化】for-each代替普通的for循环或者while循环
对于集合的遍历首选方法是for-each for(Element e :c){ doSomething(e); } 这是1.5版本之后的做法;java1.5之前使用的是Iterator迭代器。 为了弄清楚为啥比普通的for循环或者whlie循环好,请看一下代码 Iterator i=c.iterator(); while(i.hasNext()){...
分类:其他好文   时间:2014-08-02 23:26:54    阅读次数:356
Single Number II
Single Number II Given an array of integers, every element appears three times except for one. Find that single one. Note: Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?...
分类:其他好文   时间:2014-08-02 12:53:53    阅读次数:289
【HackerRank】Sherlock and Array
Watson gives an array A1,A2...AN to Sherlock. Then he asks him to find if there exists an element in the array, such that, the sum of elements on its ...
分类:其他好文   时间:2014-08-02 12:36:13    阅读次数:185
ZOJ 2112 Dynamic Rankings(主席树の动态kth)
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=2112The Company Dynamic Rankings has developed a new kind of computer that is no lon...
分类:其他好文   时间:2014-08-02 01:37:22    阅读次数:582
Remove Element
问题:删除数组中和elem相等的元素,并且返回新数组大小。英语不好。。。读错题了。。class Solution {public: int removeElement(int A[], int n, int elem) { int i,j; for(int i=0;...
分类:其他好文   时间:2014-08-01 23:03:22    阅读次数:223
LeetCode "Jump Game II"
Greedy, Greedy, Greedy.. It is all about maximum interval update.One trick is, we start looping over each element from the one nearest to end to farth...
分类:其他好文   时间:2014-08-01 13:32:21    阅读次数:283
html5画图和本地存储
Your browser does not support the canvas element.
分类:Web程序   时间:2014-08-01 13:15:21    阅读次数:231
[leetcode]Single Number
Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runti...
分类:其他好文   时间:2014-08-01 04:44:31    阅读次数:189
Java学习之Xml系列三:dtd校验、改、增、删
见摘要、见代码注释,其他话不多说: DTD文档: <?xml?version="1.0"?encoding="UTF-8"?> <!ELEMENT?SwordLibrary?(Sword*)> <!ELEMENT?Sword?(SwordName,Price,Attack)> <!ELEMENT?SwordName?(#PCDATA)...
分类:编程语言   时间:2014-08-01 00:18:51    阅读次数:359
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!