Expected Output returns incorrect result for input (9 8) (2 5) (6 4)


#1

Considering there is no pre-requisite condition provided on input, expected output returns incorrect result.
Your Input: 3 9 8 2 5 6 4
Expected output is (2, 5) (6, 4) (9, 8)

Result should be (2,9)


#2

Even though no conditions are provided on input but I think its self understood that for any interval i,
i.end >= i.start.
If this is true, then your input is invalid because of interval (6, 4) because here, end < start. That’s why the expected result is wrong.
In all the test cases used to test the code I think everytime Interval.end >= Interval.start.