摘要: 题目:Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T. The same re... 阅读全文
posted @ 2014-08-01 10:11 爱做饭的小莹子 阅读(5414) 评论(0) 推荐(1) 编辑
摘要: 题目:Write a program to solve a Sudoku puzzle by filling the empty cells.Empty cells are indicated by the character '.'.You may assume that there will ... 阅读全文
posted @ 2014-08-01 09:55 爱做饭的小莹子 阅读(4142) 评论(0) 推荐(0) 编辑
摘要: 题目:Determine if a Sudoku is valid, according to: Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled ... 阅读全文
posted @ 2014-08-01 09:43 爱做饭的小莹子 阅读(4715) 评论(0) 推荐(2) 编辑
摘要: 题目:Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For exam... 阅读全文
posted @ 2014-08-01 09:28 爱做饭的小莹子 阅读(3372) 评论(1) 推荐(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: ... 阅读全文
posted @ 2014-08-01 09:09 爱做饭的小莹子 阅读(3659) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree containing digits from 0-9 only, each root-to-leaf path could represent a number.An example is the root-to-leaf path 1->2->3 w... 阅读全文
posted @ 2014-08-01 06:08 爱做饭的小莹子 阅读(1969) 评论(2) 推荐(0) 编辑
摘要: 题目:Given inorder and postorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解:这道题跟pre... 阅读全文
posted @ 2014-08-01 05:59 爱做饭的小莹子 阅读(1657) 评论(0) 推荐(0) 编辑
摘要: 题目:Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.题解: 1 ... 阅读全文
posted @ 2014-08-01 05:44 爱做饭的小莹子 阅读(5265) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.题解:之前做过一道是从sorted array转换到BinarySearc... 阅读全文
posted @ 2014-08-01 04:25 爱做饭的小莹子 阅读(2988) 评论(1) 推荐(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... 阅读全文
posted @ 2014-08-01 03:47 爱做饭的小莹子 阅读(5564) 评论(0) 推荐(0) 编辑
摘要: 下面应用转自Wikipedia(http://zh.wikipedia.org/wiki/%E5%8D%A1%E5%A1%94%E5%85%B0%E6%95%B0):组合数学中有非常多的组合结构可以用卡塔兰数来计数。在Richard P. Stanley的Enumerative Combinato... 阅读全文
posted @ 2014-08-01 03:03 爱做饭的小莹子 阅读(904) 评论(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 B... 阅读全文
posted @ 2014-08-01 02:58 爱做饭的小莹子 阅读(5130) 评论(4) 推荐(0) 编辑
摘要: 题目:Given a 2D board and a word, find if the word exists in the grid.The word can be constructed from letters of sequentially adjacent cell, where "ad... 阅读全文
posted @ 2014-08-01 02:06 爱做饭的小莹子 阅读(5069) 评论(0) 推荐(0) 编辑