Practice Unique Binary Search Trees II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Medium#95
LeetCode ProblemUnique Binary Search Trees II
Problem Statement
Given an integer n, return all the structurally unique BST's (binary search trees), which has exactly n nodes of unique values from 1 to n. Return the answer in any order.
Source: Unique Binary Search Trees II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
n = 3
Output
[[1,null,2,null,3],[1,null,3,2],[2,1,3],[3,1,null,null,2],[3,2,null,1]]
# Example 2
Input
n = 1
Output
[[1]]
Constraints
1 <= n <= 8
Related LeetCode Problems
Practice more problems similar to Unique Binary Search Trees II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.