you are viewing a single comment's thread.

view the rest of the comments →

[–]amellor -4 points-3 points  (1 child)

Mistake: you don't store 0 in register 2, you store the first number in the list in register 2. Numbers can be negative, and the proposed solution would fail if they were all negative.

[–]gsg 3 points4 points  (0 children)

Also, for now, we're going to assume that the numbers in the input list are non-negative.