We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 41533f8 commit 3731af0Copy full SHA for 3731af0
unique-binary-search-trees-ii/Solution.java
@@ -9,7 +9,6 @@
9
*/
10
public class Solution {
11
12
-
13
ArrayList<TreeNode> generateTrees(int[] array){
14
if (array.length == 0) return new ArrayList<TreeNode>(Collections.<TreeNode>singletonList(null));
15
@@ -32,14 +31,12 @@ ArrayList<TreeNode> generateTrees(int[] array){
32
31
return found;
33
}
34
35
36
- public ArrayList<TreeNode> generateTrees(int n) {
37
- // Note: The Solution object is instantiated only once and is reused by each test case.
38
+ public List<TreeNode> generateTrees(int n) {
+
39
int[] array = new int[n];
40
41
for(int i = 0; i < n ; i++) array[i] = i + 1;
42
43
return generateTrees(array);
44
45
-}
+}
0 commit comments