摘要: 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 which represents the number 123.Find the total sum of all root-to-leaf numbers.For example, 1 / \ 2 3The root-to-leaf path 1->2 represents the num 阅读全文
posted @ 2013-05-03 21:52 kamendula 阅读(181) 评论(0) 推荐(0)
摘要: Given a 2D board containing 'X' and 'O', capture all regions surrounded by 'X'.A region is captured by flipping all 'O's into 'X's in that surrounded region .For example,X X X XX O O XX X O XX O X XAfter running your function, the board should be:X X X XX X X 阅读全文
posted @ 2013-05-03 21:19 kamendula 阅读(145) 评论(0) 推荐(0)
摘要: Given a string s, partition s such that every substring of the partition is a palindrome.Return all possible palindrome partitioning of s.For example, given s = "aab", Return [ ["aa","b"], ["a","a","b"] ]不太清楚。网上说是用dfs来做,但是可能因为自己水平不够,不明白如何算是 阅读全文
posted @ 2013-05-03 20:45 kamendula 阅读(191) 评论(0) 推荐(0)