摘要: 题目:Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equal if they are structurally identica... 阅读全文
posted @ 2014-07-30 23:44 爱做饭的小莹子 阅读(2419) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, return the postorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [3... 阅读全文
posted @ 2014-07-30 09:53 爱做饭的小莹子 阅读(1730) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, return the preorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,... 阅读全文
posted @ 2014-07-30 09:25 爱做饭的小莹子 阅读(1689) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a binary tree, return the inorder traversal of its nodes' values.For example:Given binary tree {1,#,2,3}, 1 \ 2 / 3return [1,3... 阅读全文
posted @ 2014-07-30 09:24 爱做饭的小莹子 阅读(2766) 评论(0) 推荐(0) 编辑
摘要: 题目:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n.For example,If n = 4 and k = 2, a solution is:[ [2,4], ... 阅读全文
posted @ 2014-07-30 09:18 爱做饭的小莹子 阅读(4440) 评论(0) 推荐(0) 编辑
摘要: 题目:There are N children standing in a line. Each child is assigned a rating value. You are giving candies to these children subjected to the followin... 阅读全文
posted @ 2014-07-30 08:50 爱做饭的小莹子 阅读(1819) 评论(0) 推荐(0) 编辑
摘要: 题目:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after rain... 阅读全文
posted @ 2014-07-30 08:21 爱做饭的小莹子 阅读(3858) 评论(0) 推荐(0) 编辑
摘要: 题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may com... 阅读全文
posted @ 2014-07-30 05:23 爱做饭的小莹子 阅读(3156) 评论(0) 推荐(0) 编辑
摘要: 题目:Say you have an array for which the ith element is the price of a given stock on day i.Design an algorithm to find the maximum profit. You may com... 阅读全文
posted @ 2014-07-30 04:58 爱做饭的小莹子 阅读(2824) 评论(0) 推荐(0) 编辑
摘要: 题目:Say you have an array for which the ith element is the price of a given stock on day i.If you were only permitted to complete at most one transact... 阅读全文
posted @ 2014-07-30 04:24 爱做饭的小莹子 阅读(1795) 评论(0) 推荐(0) 编辑
摘要: 题目: Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [−2,1,−3,4,−1... 阅读全文
posted @ 2014-07-30 04:06 爱做饭的小莹子 阅读(6335) 评论(0) 推荐(0) 编辑
摘要: 题目:Given a string s and a dictionary of words dict, add spaces in s to construct a sentence where each word is a valid dictionary word.Return all suc... 阅读全文
posted @ 2014-07-30 02:49 爱做饭的小莹子 阅读(3389) 评论(0) 推荐(0) 编辑