摘要: Given a binary tree, return all root-to-leaf paths.For example, given the following binary tree: 1 / \2 3 \ 5All root-to-leaf paths are:["1->... 阅读全文
posted @ 2015-08-16 16:53 irun 阅读(1156) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thebottom-up level ordertraversal of its nodes' values. (ie, from left to right, level by level from leaf to root).For exa... 阅读全文
posted @ 2015-08-16 16:21 irun 阅读(134) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2... 阅读全文
posted @ 2015-08-16 15:51 irun 阅读(114) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node down to the farthest le... 阅读全文
posted @ 2015-08-15 21:34 irun 阅读(135) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find its minimum depth.The minimum depth is the number of nodes along the shortest path from the root node down to the nearest le... 阅读全文
posted @ 2015-08-15 20:53 irun 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.(http://sudoku.com.au/TheRules.aspx)The Sudoku board could be partially filled... 阅读全文
posted @ 2015-08-13 23:50 irun 阅读(199) 评论(0) 推荐(0) 编辑
摘要: Given two sorted integer arraysnums1andnums2, mergenums2intonums1as one sorted array.Note:You may assume thatnums1has enough space (size that is great... 阅读全文
posted @ 2015-08-12 23:17 irun 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.Solution: 1 class Solution... 阅读全文
posted @ 2015-08-12 23:06 irun 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.For exampl... 阅读全文
posted @ 2015-08-11 23:38 irun 阅读(235) 评论(0) 推荐(0) 编辑
摘要: Given an array of sizen, find the majority element. The majority element is the element that appears more than⌊ n/2 ⌋times.You may assume that the arr... 阅读全文
posted @ 2015-08-11 23:07 irun 阅读(143) 评论(0) 推荐(0) 编辑