_amit.nehra_'s blog

By _amit.nehra_, history, 8 months ago, In English

There are N numbers(1 to N), arranged in increasing order. There are q operation that has to be performed on permutation. In ith operation, we'll have Li, Ri(two indices) and we have to reverse the permutation from arr[Li] to arr[Ri]. At last, after performing all operations, we have to return value at kth position.

N<=10^9
q<=10^5
1<= Li, Ri <=N
k<=N

Full text and comments »

  • Vote: I like it
  • 0
  • Vote: I do not like it