上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 21 下一页
摘要: Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line./** * Definition for a point. * struct Point { * ... 阅读全文
posted @ 2014-05-30 01:18 erictanghu 阅读(99) 评论(0) 推荐(0)
摘要: Sort a linked list using insertion sort./** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNo... 阅读全文
posted @ 2014-05-30 01:18 erictanghu 阅读(105) 评论(0) 推荐(0)
摘要: Sort a linked list inO(nlogn) time using constant space complexity./** * Definition for singly-linked list. * struct ListNode { * int val; * L... 阅读全文
posted @ 2014-05-30 01:18 erictanghu 阅读(164) 评论(0) 推荐(0)
摘要: Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identical an... 阅读全文
posted @ 2014-05-29 17:15 erictanghu 阅读(149) 评论(0) 推荐(0)
摘要: Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ... 阅读全文
posted @ 2014-05-29 17:14 erictanghu 阅读(326) 评论(0) 推荐(0)
摘要: Given a binary tree, determine if it is a valid binary search tree (BST).Assume a BST is defined as follows:The left subtree of a node contains only n... 阅读全文
posted @ 2014-05-29 17:13 erictanghu 阅读(117) 评论(0) 推荐(0)
摘要: Givens1,s2,s3, find whethers3is formed by the interleaving ofs1ands2.For example,Given:s1="aabcc",s2="dbbca",Whens3="aadbbcbcac", return true.Whens3="... 阅读全文
posted @ 2014-05-29 17:12 erictanghu 阅读(117) 评论(0) 推荐(0)
摘要: Given a binary tree, return theinordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Note... 阅读全文
posted @ 2014-05-29 17:11 erictanghu 阅读(95) 评论(0) 推荐(0)
摘要: Givenn, generate all structurally uniqueBST's(binary search trees) that store values 1...n.For example,Givenn= 3, your program should return all 5 uni... 阅读全文
posted @ 2014-05-29 17:10 erictanghu 阅读(190) 评论(0) 推荐(0)
摘要: Givenn, how many structurally uniqueBST's(binary search trees) that store values 1...n?For example,Givenn= 3, there are a total of 5 unique BST's. 1... 阅读全文
posted @ 2014-05-29 17:09 erictanghu 阅读(114) 评论(0) 推荐(0)
上一页 1 ··· 4 5 6 7 8 9 10 11 12 ··· 21 下一页