Could someone help me with the Intuition behind this solution?

Revision en1, by learningcurve_, 2023-01-02 17:26:14

I tried to think of ways to solve this problem, after not being able to think of a solution which I could reason about, I read the editorial and understood the binary search solution, but I don't understand why the greedy solution works.

Could someone help reason about the greedy solution?

Tags help, greedy

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English learningcurve_ 2023-01-02 17:26:14 468 Initial revision (published)