Baike.dev
All toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#200·interviews

Misleading example for the Greedy Algorithms section

Author: efeberkeevciCreated Sep 26, 2021Updated Jun 1, 2023

In the Greedy Algorithms section, coin change problem is provided as an example. This creates an impression that every coin change problem can be solved with greedy approach. This is incorrect since using greedy approach in some coin sets gives the incorrect result and needs to be solved with dynamic programming.

More info: https://stackoverflow.com/questions/13557979/why-does-the-greedy-coin-change-algorithm-not-work-for-some-coin-sets

Source: kdn251/interviews

View original on GitHubView discussion on GitHub