Skip to main content

Practice · 3 of 4

Mixed 2: implement from spec

CHALLENGE
Difficulty: advanced+25 XP

No topic given. A 'plateau' is a run of two or more equal adjacent values. Count the plateaus in the array (a run of 4 equal values counts as ONE plateau; separate runs count separately). Implement process(int[] arr) (0 when no plateau exists). Example: {1,1,2,2,2,3} → 2; {1,2,3} → 0.

Back to lesson: Practice: Mixed set: no labels