上一页 1 ··· 3 4 5 6 7
摘要: Problem Description:Sort a linked list inO(nlogn) time using constant space complexity.Solution: 1 public ListNode sortList(ListNode head) { 2 ... 阅读全文
posted @ 2014-06-29 13:49 HaruHaru 阅读(167) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Solution: 1 public int maxPoint... 阅读全文
posted @ 2014-06-29 13:47 HaruHaru 阅读(126) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integ... 阅读全文
posted @ 2014-06-29 13:40 HaruHaru 阅读(173) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".Solution: ... 阅读全文
posted @ 2014-06-29 13:36 HaruHaru 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.Solution: 递归。 1 public List>... 阅读全文
posted @ 2014-06-29 13:31 HaruHaru 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Problem Description: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 equ... 阅读全文
posted @ 2014-06-28 15:50 HaruHaru 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Problem Description:Given a binary tree, flatten it to a linked list in-place.Solution:对二叉树进行前序遍历(pre-order). 1 public void flatten(TreeNode root) { 2... 阅读全文
posted @ 2014-06-28 15:12 HaruHaru 阅读(128) 评论(0) 推荐(0) 编辑
摘要: Problem Desciption : Given a stringSand a stringT, count the number of distinct subsequences ofTinS.A subsequence of a string is a new string which is... 阅读全文
posted @ 2014-06-28 14:44 HaruHaru 阅读(176) 评论(0) 推荐(0) 编辑
上一页 1 ··· 3 4 5 6 7