摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"public class Solution { private ArrayList<String> rel 阅读全文
posted @ 2013-01-24 18:35 西施豆腐渣 阅读(142) 评论(0) 推荐(0) 编辑
摘要: 第一个数字是在数组里,第二个是个32bit uintuncompleted, not mine code.void add(vector<int> & a, uint b) { int remainder = 0; int i; for(i = a.size() - 1; i > -1 && b > 0; --i) { a[i] += remainder + b % 10; b = b / 10; if(a[i] >= 1... 阅读全文
posted @ 2013-01-24 18:30 西施豆腐渣 阅读(147) 评论(0) 推荐(0) 编辑
摘要: Apr 2 '12Validate if a given string is numeric.Some examples:"0"=>true" 0.1 "=>true"abc"=>false"1 a"=>false"2e10"=>trueNote:It is intended for the problem statement to be ambiguous. You should gather all requirements up front befor 阅读全文
posted @ 2013-01-24 18:22 西施豆腐渣 阅读(121) 评论(0) 推荐(0) 编辑