96. Unique Binary Search Trees

1.問題

  • 給一個n, 計算有多少BST組合

2.想法

  • When the number of nodes is 1 there is just one possible tree- this is the base case

  • Consider that every node can be the root - the nodes before it will be on the left and the nodes after it on the right

3.程式碼

4.Performance

Last updated