I am unable to understand the significance of the following line in the video solution (given here) of the problem (given here):
if (S<=X) {return true;}
The above line can be found in the ok function defined in the video solution. I tried commenting the lines but that results in my code failing test cases 7 and 9 and also I get a TLE in test cases 5 ,6 and 8. I thought at first that this might be due to the fact that at the end once we reach speed X it doesn’t matter if we satisfy the condition involving the sum_ function but after changing <= to == , I am getting the same verdict(WA on 7 and 9 and TLE on 5,6 and 8).
I would appreciate any help here!