Skip to main content

Practice · 5 of 5

Implement the survivor

CHALLENGE
Difficulty: intermediate+25 XP

The lesson presented four candidates for "true when arr contains two ADJACENT equal values" (A: for-each with i+1; B: loop to length-1 comparing i, i+1; C: loop to length comparing i+1; D: nested loop over all pairs). Implement the CORRECT one — the adjacency machine with the right bound.

Back to lesson: Practice: MCQ clinic