number of valid parenthesis [UBER Phone][Reject]

Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2020-07-26Added By Anonymous
Source: Link

Company: Uber

Interview Stage: Phone Screen


Original Post Content:


For given n find the number of valid combinations of valid parenthesis.I told him direct formula of

Catalan number(becuase i encountered this prob earlier) but he specifically wanted this problem Solution using dynamic programming and wanted working solution with explanation with Test cases.I didn't managed to get to the working solution.


Eg


n=1 valid par=0

n=2 valid par=1

Comments