@iar
2015-04-17 07:58
字数 6637
阅读 113
leetcode
private static void recur(String s, int left, List<List<String>> result) {
if (left == s.length()) {
result.add(new ArrayList<String>());
}
for (int i = left; i < s.length(); ++i) {
List<List<String>> temp = new ArrayList<List<String>>();
recur(s, i + 1, temp);
for (List<String> partitions : temp) {
partitions.add(0, s.substring(left, i + 1));
}
result.addAll(temp); // add()和addAll()的区别.
}
}
Construct Binary Tree from Inorder and Postorder traversal
construct binary tree from preorder and inorder traversal
# | Leetcode problem | freq |
---|---|---|
26 | 3 | |
83 | 3 | |
112 | 3 | |
7 | 3 | |
19 | 3 | |
62 | 3 | |
108 | 3 | |
17 | Letter Combinations of a Phone Number | 3 |
39 | Combination Sum | 3 |
53 | Maximum Subarray | 3 |
63 | 3 | |
64 | 3 | |
74 | Search a 2D Matrix | 3 |
82 | 3 | |
86 | Partition List | 3 |
93 | 3 | |
105 | 3 | |
106 | 3 | |
114 | 3 | |
116 | ~~Populating Next Right Pointers in Each Node | 3 |
29 | ~~Divide Two Integers | 3 |
33 | ~~Search in Rotated Sorted Array | 3 |
34 | 3 | |
43 | 3 | |
51 | 3 | |
52 | 3 | |
72 | 3 | |
94 | 3 | |
103 | 3 | |
109 | 3 | |
128 | 3 | |
130 | 3 | |
132 | 3 | |
4 | 3 | |
10 | 3 | |
44 | 3 | |
81 | 3 | |
end | 念念不忘必有回响 | 3 |