Given two binary strings, return their sum (also a binary string). For example,a = "11"b = "1"Return "100".Solution: 1 public class Solution { 2 p...
分类:
其他好文 时间:
2014-11-29 07:07:04
阅读次数:
154
Given a binary tree, return the level order traversal of its nodes' values. (ie, from left to right, level by level). For example:Given binary tree {3...
分类:
其他好文 时间:
2014-11-29 07:06:01
阅读次数:
191
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...
分类:
其他好文 时间:
2014-11-29 06:50:19
阅读次数:
189
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 all...
分类:
其他好文 时间:
2014-11-29 06:47:54
阅读次数:
165
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,2]...
分类:
其他好文 时间:
2014-11-29 06:47:04
阅读次数:
137
Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and ...
分类:
其他好文 时间:
2014-11-29 06:40:34
阅读次数:
167
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 BST'...
分类:
其他好文 时间:
2014-11-29 06:36:51
阅读次数:
160
Given preorder and inorder traversal of a tree, construct the binary tree.Note:You may assume that duplicates do not exist in the tree.Solution: 1 /**...
分类:
其他好文 时间:
2014-11-29 01:31:14
阅读次数:
256
描述Given two strings A and B, whose alphabet consist only ‘0’ and ‘1’. Your task is only to tell how many times does A appear as a substring of B? For ...
分类:
其他好文 时间:
2014-11-29 00:03:11
阅读次数:
442
返回树的深度。递归:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val...
分类:
其他好文 时间:
2014-11-28 16:06:24
阅读次数:
103