[LeetCode] Decode Ways, Solution

摘要: 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 @ 2013-01-28 13:35 小刀初试 阅读(173) 评论(0) 推荐(0)

[LeetCode] Count and Say, Solution

摘要: The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ...1 is read off as "one 1" or 11.11 is read off ... 阅读全文
posted @ 2013-01-28 13:09 小刀初试 阅读(135) 评论(0) 推荐(0)

[LeetCode] Convert Sorted List to Binary Search Tree, Solution

摘要: Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST.» Solve this problem[Thoughts]It is simil... 阅读全文
posted @ 2013-01-28 12:28 小刀初试 阅读(160) 评论(0) 推荐(0)

[LeetCode] Container With Most Water, Solution

摘要: Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo... 阅读全文
posted @ 2013-01-28 11:35 小刀初试 阅读(133) 评论(0) 推荐(0)

[LeetCode] Construct Binary Tree from Preorder and Inorder Traversal, Solution

摘要: Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.» Solve this pr... 阅读全文
posted @ 2013-01-28 10:50 小刀初试 阅读(125) 评论(0) 推荐(0)