I was kindoff thinking to iterate over intervals in ascending order of C and keep the variable when was the last time canon was shot. Then for each next interval check if the canon can be shot in this interval or not?
Am I going in right direction?
Here’s my submission. We are doing pretty much the same thing. Your starting value of right is not right(You can get an upper bound for it). I can’t find the bug in your code. Its mostly to do with the end of your binary search