Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? NoteYou can not divide any item into s...
分类:
其他好文 时间:
2015-02-03 09:27:39
阅读次数:
160
For given numbers a and b in function aplusb, return the sum of them.NoteYou don't need to parse the input and output. Just calculate and return.Examp...
分类:
其他好文 时间:
2015-02-03 06:59:57
阅读次数:
122
http://lintcode.com/en/problem/rehashing/#/**
*DefinitionforListNode
*publicclassListNode{
*intval;
*ListNodenext;
*ListNode(intx){
*val=x;
*next=null;
*}
*}
*/
publicclassSolution{
/**
*@paramhashTable:AlistofThefirstnodeoflinkedlist
*@return:AlistofThefir..
分类:
其他好文 时间:
2015-01-14 18:16:17
阅读次数:
211
http://lintcode.com/en/problem/compare-strings/publicclassSolution{
/**
*@paramA:AstringincludesUpperCaseletters
*@paramB:AstringincludesUpperCaseletter
*@return:ifstringAcontainsallofthecharactersinBreturntrueelsereturnfalse
*/
publicbooleancompareStrings(..
分类:
其他好文 时间:
2015-01-14 18:11:48
阅读次数:
145
http://lintcode.com/en/problem/kth-prime-number/#classSolution{
/**
*@paramk:Thenumberk.
*@return:Thekthprimenumberasdescription.
*/
publiclongkthPrimeNumber(intk){
//writeyourcodehere
Queue<Long>q3=newLinkedList<>();
q3.offer(3L);
Queue<Lon..
分类:
其他好文 时间:
2015-01-14 18:08:01
阅读次数:
163
Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack?注意You can not divide any item into smal...
分类:
其他好文 时间:
2015-01-14 08:29:24
阅读次数:
339
http://lintcode.com/en/problem/backpack-ii/publicintbackPackII(intm,int[]A,intV[]){
//writeyourcodehere
//Bruteforce
//returnhelp(m,A,V,0,0,0);
int[][]max=newint[A.length+1][m+1];
for(int[]t:max)
Arrays.fill(t,-1);
for(inti=0;i<A.length+1;i++)
max[i]..
分类:
其他好文 时间:
2015-01-12 11:09:10
阅读次数:
194
Given amxngrid filled with non-negative numbers, find a path from top left to bottom right whichminimizesthe sum of all numbers along its path. ...
分类:
其他好文 时间:
2015-01-09 09:10:42
阅读次数:
176
Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is called 'serialization' and reading back f...
分类:
其他好文 时间:
2015-01-08 13:17:33
阅读次数:
207
Longest Common SubsequenceGiven two strings, find the longest comment subsequence (LCS).Your code should return the length of LCS.样例For "ABCD" and "ED...
分类:
其他好文 时间:
2015-01-03 15:55:06
阅读次数:
177