Stores the stations and respective rate of fuel
HashMap < Integer , Integer > map = new HashMap < > ( ) ; for ( int i = 0 ; i < M ; i ++ ) { map . put ( a [ i ] , b [ i ] ) ; if ( i == M - 1 && K < N - a [ i ] ) { flag = false ; break ; } else if ( i < M - 1 && K < a [ i + 1 ] - a [ i ] ) { flag = false ; break ; } } if ( ! flag ) { System . out . println ( " - 1" ) ; return ; }