Function to check if two intervals overlap with each other
public static Boolean checkOverlapping ( ArrayList < Integer > a , ArrayList < Integer > b ) { if ( a . get ( 0 ) < b . get ( 0 ) ) { int temp = a . get ( 0 ) ; a . set ( 0 , b . get ( 0 ) ) ; b . set ( 0 , temp ) ; temp = a . get ( 1 ) ; a . set ( 1 , b . get ( 1 ) ) ; b . set ( 1 , temp ) ; }