Checkpoint: runs count once
Challenge on lesson: Checkpoint: compose under contract
CHALLENGE
Difficulty: intermediate+25 XP
Upgrade the broken compress: sum elements, but each RUN of equal adjacent elements counts once ({2,2,5,5,5,1} โ 8). The broken version sums every element (15). Compare each element with its predecessor โ one extra condition in the loop body is enough.
Press Submit to check your solution.
Back to lesson: Checkpoint: compose under contract