摘要: Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After re... 阅读全文
posted @ 2014-11-05 07:30 lilyfindjob 阅读(98) 评论(0) 推荐(0)
摘要: Given a non-negative number represented as an array of digits, plus one to the number.The digits are stored such that the most significant digit is at... 阅读全文
posted @ 2014-11-04 12:46 lilyfindjob 阅读(96) 评论(0) 推荐(0)
摘要: You are climbing a stair case. It takesnsteps to reach to the top.Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb... 阅读全文
posted @ 2014-11-03 12:51 lilyfindjob 阅读(93) 评论(0) 推荐(0)
摘要: Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists.1,注意从新定义l... 阅读全文
posted @ 2014-11-03 08:23 lilyfindjob 阅读(97) 评论(0) 推荐(0)
摘要: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[−2,1,−3,4,−1,2,1,... 阅读全文
posted @ 2014-11-02 06:22 lilyfindjob 阅读(104) 评论(0) 推荐(0)
摘要: Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文
posted @ 2014-11-02 05:56 lilyfindjob 阅读(156) 评论(0) 推荐(0)
摘要: Given an indexk, return thekthrow of the Pascal's triangle.For example, givenk= 3,Return[1,3,3,1].Note:Could you optimize your algorithm to use onlyO(... 阅读全文
posted @ 2014-10-31 08:06 lilyfindjob 阅读(128) 评论(1) 推荐(0)
摘要: 1, ArrayList 的用法 add,get2,for 循环中,每执行一遍,注意i的值已经加1public class Solution { public ArrayList> generate(int numRows) { ArrayList> result=new Arr... 阅读全文
posted @ 2014-10-29 07:20 lilyfindjob 阅读(102) 评论(0) 推荐(0)
摘要: 1, 堆栈的应用,算是很经典的题目2,记得给stack 设置类型,否则就是objectpublic class Solution { public boolean isValid(String s) { if(s.length()==0||s.length()==1){ ... 阅读全文
posted @ 2014-10-29 01:52 lilyfindjob 阅读(124) 评论(0) 推荐(0)
摘要: Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum.Fo... 阅读全文
posted @ 2014-10-28 06:20 lilyfindjob 阅读(111) 评论(0) 推荐(0)