Intermediatecoding Verified
How many structurally unique binary search trees can be built with the values 1 to N?
ReportedSource: GeeksforGeeks interview experience: Swiggy SDE-1 off-campus 2021
Quick answerFree
Catalan numbers: G(n) = sum G(i-1)·G(n-i) over roots i (O(n²) DP), or C(n) = (2n)!/((n+1)! n!). n=3 -> 5, n=4 -> 14.
Detailed answer· ~120 words
Interview PrepUnlock the full answer with Interview Prep
Get a ~120-word model answer and a runnable reference solution, plus 61 more DSA questions.
Also in Pro (₹499 / 90 days).
Reference solution· runs in the browser sandbox
Interview PrepUnlock with Interview Prep
+ 61 more DSA questions in Interview Prep, each with the full answer.