Greedy
Make the locally optimal choice at each step to build a globally optimal solution without backtracking.
Make the locally optimal choice at each step to build a globally optimal solution without backtracking.
The carried answer always represents the best outcome achievable from any starting point up to the current position while scanning.
When the optimal substructure holds and choices are independent, a single forward pass suffices.
The greedy choice property guarantees that locally optimal choices compose into a globally optimal answer.