L_Drago_Destructor's blog

By L_Drago_Destructor, history, 22 months ago, In English

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.

  • Vote: I like it
  • +2
  • Vote: I do not like it

»
22 months ago, # |
  Vote: I like it 0 Vote: I do not like it

what are the constrains for n and k?

»
22 months ago, # |
  Vote: I like it +6 Vote: I do not like it

You can find the solution here.

  • »
    »
    22 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Thanks! What difficulty do you think this (problem) is? Because I don't want to try to solve something that is way above my level.