|
|
|
|
|
by edc117
1752 days ago
|
|
You forgot the other half of the question - is your solution the only possible answer? - at which point you can really only evaluate all possible combinations. I agree it's one of several ways to test for a 'clever' student, though. |
|
You only need one counterexample, and in this case you can easily find it. E.g., you can note that the duckie in GP's solution can be swapped for the pinwheel+whistle without changing the solution's total cost, ergo the solution isn't unique.
I think a lot of people are looking at this like a coding interview, where it's assumed that your algorithm must work for all possible inputs, rather than just the inputs stated.