-
5 Comments
In above case it returns 567.90, correct answer would be 167.94. This solution is minimizing last digit which works in most cases, but is based on wrong assumptions. It passes test, but doesn't solve the problem. Yes, my later submissions doesn't have this bug, but I'm unsatisfied when those wrong ones are going through the test alive :-)
You had me confused, since that specific combination isn't in the test suite, but I think I understand now. In your quest for perfection, you've been testing the solution against more test cases. That's the really difficult thing about making these problems—coming up with a robust test suite that's in-depth enough to only let completely correct solutions through.
Sorry Grant. Yes, I'm used to do more tests and I was suspicious about my algorithm.
Suggested Problems
-
17778 Solvers
-
Create a random logical vector of N elements of which M are true.
102 Solvers
-
185 Solvers
-
613 Solvers
-
Replace Nonzero Numbers with 1
407 Solvers
More from this Author139
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!