Driver code
public static void main ( String args [ ] ) { int a [ ] = { 1 , 5 , 4 , 2 , 8 , 6 , 7 } ; int n = a . length ; int q [ ] [ ] = { { 2 , 5 } , { 1 , 3 } , { 1 , 5 } , { 3 , 6 } } ; int m = q . length ; solveQueries ( a , n , q , m ) ; } }