Driver Code
public static void main ( String args [ ] ) { int n = 5 ; int r = 2 ; int arr [ ] = { 400 , 567 , 890 , 765 , 987 } ; int ranges [ ] [ ] = { { 300 , 380 } , { 800 , 1000 } } ; ArrayList < Integer > answer = new ArrayList < > ( ) ;