A greedy algorithm commits to the choice that looks best right now and never revisits it. It is fast, usually a sort plus one pass, but it is only correct when you can argue that the local choice never hurts the final answer.
The usual argument is an exchange: take any optimal answer, swap one of its choices for the greedy choice, and show the answer is no worse. If buying the cheapest item first never lowers the item count, buying cheapest first is safe. If a failure at depot i rules out every depot before it, restarting after i is safe.
Recognize greedy problems by a natural order (cheapest, earliest end, smallest difference) and a choice that does not limit later options. Be suspicious when an earlier choice can block a better combination later: coin systems with odd denominations and knapsacks with values are the classic cases where greedy fails and dynamic programming is needed. In an interview, say the exchange argument out loud before you code.
Sort by what a choice saves, then commit.