Skip to main content

Practice · 3 of 5

Fix the alternating sum

CHALLENGE
Difficulty: intermediate+25 XP

sumAlt must compute arr[0] - arr[1] + arr[2] - ... but both branches add. Trace {5, 2, 7} against the contract, then repair the minimal line.

Back to lesson: Practice: Flow lab