Driver Code
let arr = [ 1 , 2 , 2 , 3 , 4 , 4 , 5 , 6 ] ; let n = arr . length ; let Q = [ [ 1 , [ 3 , 5 ] ] , [ 1 , [ 2 , 4 ] ] , [ 1 , [ 1 , 2 ] ] , [ 2 , [ 1 , 7 ] ] , [ 1 , [ 1 , 2 ] ] ] ; SolveQuery ( arr , n , Q ) ;