Back to General discussions forum
I've been stumped on this one for a while. I can't seem to figure out why, in the example, (1 +0.7) is not valid at that point where it appears. Here's what I've come up with:
Last good array (hand-checked): [3.0, 4.8, 3.5, 3.6, 1.0]
Array with changes (1 +0.7): [3.0, 5.5, 3.5, 3.6, 1.0]
I can't understand why this change is not valid in the example... My solution produces the correct answer for the example data, and I checked my simulation results against the Javascript widget in the page, but the actual problem submission always fails. I think I'm missing something here.
Anybody else having issues with this one?
After (2 +0.5) the array is [3.0, 5.6, 3.5, 3.6, 1.0] which is the final array value.
(1 -0.8) doesn't change the array because it doesn't make any improvement.
AH! That's what it was; I misunderstood the speeds array update condition. The adjustments in the given sequence are kept only if they produce a valid array AND they result in a better time. Thanks for the help, Quandray!
My question was moved to a new topic.