摘要: 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-11-09 23:15 Agentgamer 阅读(127) 评论(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-11-09 21:56 Agentgamer 阅读(145) 评论(0) 推荐(0)
摘要: GivennumRows, generate the firstnumRowsof Pascal's triangle.For example, givennumRows= 5,Return[ [1], [1,1], [1,2,1], [1,3,3,1], [1,4,6,4,1]... 阅读全文
posted @ 2014-11-09 21:08 Agentgamer 阅读(141) 评论(0) 推荐(0)
摘要: Given a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, return1->2.Given1->1->2->3->3, retu... 阅读全文
posted @ 2014-11-09 20:20 Agentgamer 阅读(121) 评论(0) 推荐(0)
摘要: Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space (size that is greater or equal... 阅读全文
posted @ 2014-11-09 18:00 Agentgamer 阅读(132) 评论(0) 推荐(0)
摘要: Given a binary tree, flatten it to a linked list in-place.For example,Given 1 / \ 2 5 / \ \ 3 4 6The flattened t... 阅读全文
posted @ 2014-11-09 14:52 Agentgamer 阅读(123) 评论(0) 推荐(0)
摘要: Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases.For example,"A man, a plan, a canal: Pana... 阅读全文
posted @ 2014-11-09 13:55 Agentgamer 阅读(116) 评论(0) 推荐(0)