上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 28 下一页
摘要: 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 @ 2015-05-21 21:26 TonyLuis 阅读(168) 评论(0) 推荐(0) 编辑
摘要: Given s1, s2, s3, find whether s3 is formed by the interleaving of s1 and s2. For example,Given:s1 = "aabcc",s2 = "dbbca",When s3 = "aadbbcbcac", retu... 阅读全文
posted @ 2015-05-21 21:18 TonyLuis 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, there are a total of 5 unique BST'... 阅读全文
posted @ 2015-05-21 17:35 TonyLuis 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should return all... 阅读全文
posted @ 2015-05-21 17:23 TonyLuis 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 解题思路:中序遍历,左子树-根节点-右子树JAVA实现如下: public List inorderTraversal(TreeNode root) { List list = new ArrayList(); if(root==null) r... 阅读全文
posted @ 2015-05-20 22:55 TonyLuis 阅读(169) 评论(0) 推荐(0) 编辑
摘要: Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given "25525511135",return ["25... 阅读全文
posted @ 2015-05-20 22:16 TonyLuis 阅读(165) 评论(0) 推荐(0) 编辑
摘要: Reverse a linked list from position m to n. Do it in-place and in one-pass. For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->... 阅读全文
posted @ 2015-05-20 10:57 TonyLuis 阅读(137) 评论(0) 推荐(0) 编辑
摘要: A message containing letters from A-Z is being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message con... 阅读全文
posted @ 2015-05-20 10:18 TonyLuis 阅读(184) 评论(0) 推荐(0) 编辑
摘要: Given a collection of integers that might contain duplicates, nums, return all possible subsets.Note:Elements in a subset must be in non-descending or... 阅读全文
posted @ 2015-05-20 01:01 TonyLuis 阅读(157) 评论(0) 推荐(0) 编辑
摘要: The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integer n representing the total numb... 阅读全文
posted @ 2015-05-20 00:52 TonyLuis 阅读(167) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 28 下一页