For example,
a = "11"
b = "1"
Return "100".
这题的做法和前面一题plus one 一样,区别在于需要将两个string先相加,再判断是否要进位。
直接上代码吧。
class Solution:
# @param a, a string
# @param b, a string
# @return a string
...
分类:
编程语言 时间:
2015-02-05 09:36:04
阅读次数:
153
Given a (decimal - e g 3.72) number that is passed in as a string,return the binary representation that is passed in as a string.If the number can no....
分类:
其他好文 时间:
2015-02-05 07:03:58
阅读次数:
147
Binary search is a famous question in algorithm.For a given sorted array (ascending order) and a target number, find the first index of this number in...
分类:
其他好文 时间:
2015-02-05 07:02:22
阅读次数:
91
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...
分类:
其他好文 时间:
2015-02-05 00:39:43
阅读次数:
144
读xml生成相应的 lua解析协议代码:
#include
#include "tinyxml2.h"
#include
#include
using namespace tinyxml2;
using namespace std;
std::ofstream file("readProto.lua",std::ios::ate|std::ios::binary);
void r...
分类:
其他好文 时间:
2015-02-04 23:27:37
阅读次数:
168
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 tota...
分类:
其他好文 时间:
2015-02-04 21:57:07
阅读次数:
180
Tree Recovery
Time Limit: 1000MS
Memory Limit: 65536K
Total Submissions: 11955
Accepted: 7505
Description
Little Valentine liked playing with binary trees very much...
分类:
其他好文 时间:
2015-02-04 21:55:50
阅读次数:
248
Two elements of a binary search tree (BST) are swapped by mistake.Recover the tree without changing its structure.Note:A solution using O(n) space is ...
分类:
其他好文 时间:
2015-02-04 18:03:07
阅读次数:
163
题目:
Suppose a sorted array is rotated at some pivot unknown to you beforehand.
(i.e., 0 1 2 4 5 6 7 might become 4
5 6 7 0 1 2).
Find the minimum element.
The array may contain duplicate...
分类:
编程语言 时间:
2015-02-04 16:39:32
阅读次数:
150
Little Valentine liked playing with binary trees very much. Her favorite game was constructing randomly looking binary trees with
capital letters in the nodes.
This is an example of one of her cre...
分类:
其他好文 时间:
2015-02-04 13:06:31
阅读次数:
183