摘要: Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()" 1 public static List<string> GenerateParentheses 阅读全文
posted @ 2012-09-06 05:00 ETCOW 阅读(487) 评论(2) 推荐(0) 编辑
摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given [1,2,0] return 3,and [3,4,-1,1] return 2.Your algorithm should run in O(n) time and uses constant space.JAVA 正解如下: 1 public class Solution { 2 public int firstMissingPositive(int[] A) { 3 // Start ... 阅读全文
posted @ 2012-09-06 04:37 ETCOW 阅读(494) 评论(9) 推荐(1) 编辑