Skip to content

Commit 97fb733

Browse files
author
Wenchao Ding
authored
O(n) -> O(n^2)
1 parent eca6d96 commit 97fb733

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Tree/UniqueBinarySearchTrees.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* Question Link: https://leetcode.com/problems/unique-binary-search-trees/
33
* Primary idea: Dynamic programming, for each node as root, dp[i] += dp[j] * dp[i - j - 1]
44
*
5-
* Time Complexity: O(n), Space Complexity: O(n)
5+
* Time Complexity: O(n^2), Space Complexity: O(n)
66
*
77
* Definition for a binary tree node.
88
* public class TreeNode {
@@ -34,4 +34,4 @@ class UniqueBinarySearchTrees {
3434

3535
return dp[n]
3636
}
37-
}
37+
}

0 commit comments

Comments
 (0)