Skip to main content

Practice · 2 of 5

Between first and last

CHALLENGE
Difficulty: intermediate+25 XP

Implement int between(int[] arr, int key): how many elements lie strictly between the first and last occurrence of key. Absent or single occurrence → 0. Work a three-element example by hand before coding the index algebra.

Back to lesson: Practice: Flow lab