Driver code
public static void main ( String [ ] args ) { int N = 8 , queries = 6 ; int Q [ ] [ ] = { { 1 , 4 } , { 3 , 4 } , { 4 , 5 } , { 5 , 5 } , { 7 , 8 } , { 8 , 8 } } ; int A [ ] = new int [ N ] ; System . out . print ( subarrayLength ( A , Q , N , queries ) ) ; } }