I have m queries and each query I have to reverse the array between given indices L,R.
The input array always contain numbers from 1 to n in sorted order .
example:
n=5
array=[1,2,3,4,5]
query 2,4 will reverse the array between 2 and 4 and the new array will be [1,4,3,2,5]
how to approach the above problem using segment trees.Thanks in advance.https://www.hackerrank.com/challenges/helix/problem