Driven Program
int main ( ) { int arr [ ] = { 1 , 2 , 3 , 4 , 5 } ; int n = sizeof ( arr ) / sizeof ( arr [ 0 ] ) ; int l [ ] = { 1 , 1 , 2 } ; int r [ ] = { 2 , 3 , 4 } ; int q = sizeof ( l ) / sizeof ( l [ 0 ] ) ; ansQueries ( arr , n , l , r , q ) ; return 0 ; }