Dsa
Dynamic Programming
Medium
Balanced Parentheses Strings
You are tasked to count the number of distinct strings that can be formed using n pairs of balanced parentheses. Write a function that takes an integer n and returns the count of such strings. The count should be calculated using dynamic programming.
Input format:
- A single line containing the integer n (1 <= n <= 30).
Output format:
- A single integer representing the count of distinct balanced parentheses strings.
Example:
Input:
3
Output:
5
Key concepts
dynamic_programmingcombinatorics
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now