Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
我的C++实现代码如下:
string addBinary(string a, string b) {
string sum;
int c...
分类:
其他好文 时间:
2014-11-26 22:43:30
阅读次数:
196
char 类型是c语言中常见的一个数据类型,string是c++中的一个,它的定义为Strings are objects that represent sequences of characters. 由此可见string是一个char序列的对象,有时候我们经常需要混用这两个数据类型,所以有些常见...
分类:
其他好文 时间:
2014-11-26 18:24:25
阅读次数:
168
Not so MobileBefore being an ubiquous communications gadget, amobilewas just a structure made of strings and wires suspending colourfull things. This ...
分类:
其他好文 时间:
2014-11-26 12:49:07
阅读次数:
222
Given an array of strings, return all groups of strings that are anagrams.Note: All inputs will be in lower-case.参考:http://www.cnblogs.com/AnnieKim/ar...
分类:
其他好文 时间:
2014-11-26 01:08:54
阅读次数:
190
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
思路:对每一个单词的所有字母按照字典顺序排序,排序结果作为key,所有具有相同key的单词组合在一起成为一个Anagram group。最后返回所有的Anag...
分类:
其他好文 时间:
2014-11-25 23:42:35
阅读次数:
195
Palindrome PartitioningGiven a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioni...
分类:
其他好文 时间:
2014-11-25 22:48:55
阅读次数:
241
这个题目相对有点奇怪,题目如下: Given two binary strings, return their sum (also a binary string). For example, a = "11" b = "1" Return "100". 可能是我思路的问题吧,我之前是在考虑先将st...
分类:
其他好文 时间:
2014-11-25 00:01:55
阅读次数:
180
今天写代码遇到一个奇怪的问题,具体代码不贴出了,写一个简化的版本。如下: ArrayList<String> list=new ArrayList<String>(); String strings[]=(String [])list.toArray(); 这样写代码个人觉得应该没什么问题...
分类:
编程语言 时间:
2014-11-24 22:49:30
阅读次数:
315
Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-11-24 22:22:57
阅读次数:
218
Given two binary strings, return their sum (also a binary string).
For example,
a = "11"
b = "1"
Return "100".
#include
#include
char* addBinary(char a[], char b[]) {
int na=strlen(a);
...
分类:
其他好文 时间:
2014-11-24 17:13:45
阅读次数:
191