LeetCode - 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:
"((()))", "(()())", "(())()", "()(())", "()()()"
题解: 需要用dfs -backtracking.
给定的n为括号对,也就是有n个...
分类:
其他好文 时间:
2015-04-02 13:30:32
阅读次数:
158
题目:Given a linked list, swap every two adjacent nodes and return its head.
For example,
Given 1->2->3->4, you should return the list as 2->1->4->3.
Your algorithm should use only constant space...
分类:
其他好文 时间:
2015-04-02 10:31:49
阅读次数:
114
题目地址:http://blog.csdn.net/shiyuankongbu/article/details/10004443 1 /* 2 题意:在i前面找回文子串,在i后面找回文子串相互配对,问有几对 3 DP:很巧妙的从i出发向两头扩展判断是否相同来找回文串 4 ...
分类:
其他好文 时间:
2015-04-01 21:30:11
阅读次数:
119
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:
"((()))", "(()())", "(())()",
"()(())", "()()()...
分类:
其他好文 时间:
2015-04-01 11:25:47
阅读次数:
110
周赛时遇到的一道比较有意思的题目:Problem StatementThere are N rooms in Maki's new house. The rooms are numbered from 0 to N-1. Some pairs of rooms are connected by bi...
分类:
编程语言 时间:
2015-04-01 11:10:30
阅读次数:
159
练习3-67原文Exercise 3.67. Modify the pairs procedure so that (pairs integers integers) will produce the stream of all pairs of integers (i,j) (without the condition i < j). Hint: You will need to mix in...
分类:
其他好文 时间:
2015-03-29 10:55:03
阅读次数:
160
练习3-66原文Exercise 3.66. Examine the stream (pairs integers integers). Can you make any general comments about the order in which the pairs are placed into the stream? For example, about how many pairs...
分类:
其他好文 时间:
2015-03-29 10:55:03
阅读次数:
110
练习3-68原文Exercise 3.68. Louis Reasoner thinks that building a stream of pairs from three parts is unnecessarily complicated. Instead of separating the pair (S0,T0) from the rest of the pairs in the fir...
分类:
其他好文 时间:
2015-03-29 10:52:16
阅读次数:
136
题目链接:generate-parentheses
import java.util.ArrayList;
import java.util.List;
/**
*
Given n pairs of parentheses, write a function to generate
all combinations of well-formed parentheses.
...
分类:
其他好文 时间:
2015-03-28 08:49:39
阅读次数:
105
题目描述:Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, given n = 3, a solution set i...
分类:
其他好文 时间:
2015-03-20 23:21:33
阅读次数:
248