Editorial for Another Contest 8 Problem 2 - Unnecessary Trash Push

Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.

Submitting an official solution before solving the problem yourself is a bannable offence.

This problem can be solved in constant memory by maintaining a running total of the amount of trash so far - when the sum is greater than or equal to K, increment a running counter by one. Print the running counter at the end.


There are no comments at the moment.