A good practice for the greedy algorithm. To waive duplicate computation, keep one local observatory variable and update it along the iteration.
Description