大致题意:给定一个整数,比如32,32=11+11+10。。。给定一个整数n,它可以由0 和1 组成的整数的和组成,求最少需要几个这样0 和 1的整数。比如32至少需要3个。分析:把输入的这个整数当成字符串处理。比如s=“32” s[0]=' 3 ' ,s[1]=' 2 ';那么,我们做一个二维数组...
分类:
其他好文 时间:
2015-05-03 01:58:25
阅读次数:
154
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3602Count the TreesTime Limit:2 Seconds Memory Limit:65536 KBA binary tree is a tree data...
分类:
其他好文 时间:
2015-05-02 23:19:50
阅读次数:
183
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's.
1 3 3 2 1
\ ...
分类:
其他好文 时间:
2015-05-02 18:11:24
阅读次数:
110
1.题目Given two binary strings, return their sum (also a binary string).For example,a = "11"b = "1"Return "100".2.解答class Solution {
public:
char intToChar(int input){
char strBuffer[1] = {0...
分类:
其他好文 时间:
2015-05-02 16:37:23
阅读次数:
110
题目: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 identical and the nodes have the same value.
解题思路:这题...
分类:
其他好文 时间:
2015-05-02 16:36:20
阅读次数:
104
iven 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 5 unique BST's shown below.
1 3 ...
分类:
其他好文 时间:
2015-05-02 16:35:48
阅读次数:
138
题目: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 identical...
分类:
其他好文 时间:
2015-05-02 16:32:51
阅读次数:
116
https://leetcode.com/problems/same-tree/Given two binary trees, write a function to check if they are equal or not.Two binary trees are considered equ...
分类:
其他好文 时间:
2015-05-02 13:38:23
阅读次数:
137
Given preorder and inorder traversal of a tree, construct the binary tree.
Note:
You may assume that duplicates do not exist in the tree.
题意:二叉树前、中序构造出二叉树。
思路:经典的题目。
/**
* Definition for a bin...
分类:
其他好文 时间:
2015-05-02 11:17:03
阅读次数:
174
Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center).For example, this binary tree is symmetric: 1 / \ 2 2...
分类:
其他好文 时间:
2015-05-02 11:06:18
阅读次数:
118