Greedy Or Not?
Computer Science Level 3There is a list of coins : \(L = \{100000,10000,1000,100,10,1\}\)
You want to know the minimum number of coins needed to achieve value \(V\), so you asked the two best programmers in the world, Alice and Bob, and each of them proposed a different algorithm:
Alice [Dynamic Programming] :
1 2 3 4 5 6 7 8 

Bob [Greedy] :
1 2 3 4 5 6 7 

Which is the better algorithm? Of course, correctness is your top priority, then the speed.
Your answer seems reasonable.
Find out if you're right!
Sign up to access problem solutions.
That seems reasonable.
Find out if you're right!
Already have an account? Log in here.