Note: This isn't fully relevant to what we do here with coding interviews (you'll never be asked to prove a greedy algorithm), but as I mentioned in the intro to Greedy Algorithms, most of the work goes into proving that greedy strategies we create are correct versus actually coming up with the ideas themselves. I think the logic presented here helps you weigh if a greedy approach will work or not.
0 comments