Function to check if the intervals can be added by X to form non - overlapping intervals
def checkNonOverlapping ( arr , n ) : NEW_LINE INDENT dsu = [ i for i in range ( n + 1 ) ] NEW_LINE for i in range ( n ) : NEW_LINE INDENT for j in range ( i + 1 , n ) : NEW_LINE DEDENT DEDENT