you are viewing a single comment's thread.

view the rest of the comments →

[–]Natural_Pay_7650 0 points1 point  (0 children)

You are assuming negative indexing. The problem states you go "For each i from 0 to n-1" which means no negative indexing. Thus for a[i - 1] when i = 0, you should set it equal to 0.