Help needed in parenthesis problem

Revision en2, by L_Drago_Destructor, 2023-02-04 23:57:40

I was solving national OI when I stumbled across this (simple?) problem which I was unable to solve.

"Given N and K find the k-th lexicographically correct parenthesis of length N".

Example:

N = 4 k = 2

()()

Thanks in advance! Hope this question will help somebody else too.

Tags brackets matching

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English L_Drago_Destructor 2023-02-04 23:58:35 0 (published)
en2 English L_Drago_Destructor 2023-02-04 23:57:40 2 Tiny change: '4 k = 2\n()()\n\n' -> '4 k = 2\n\n()()\n\n'
en1 English L_Drago_Destructor 2023-02-04 23:57:21 332 Initial revision (saved to drafts)