Balife greedy algo


Giving TLE. What’s the error?

there were some mistakes in the for loop which is at the end . here is your corrected code