Skip to main content

Practice · 5 of 6

Mode with a defined tie-break

CHALLENGE
Difficulty: advanced+25 XP

Return the **mode** (most frequent value). On ties, return the **smallest** value among the tied ones. The list is non-empty. Implement process(java.util.ArrayList<Integer> list). Example: [2,3,2,3,5] → 2 (2 and 3 tie; 2 is smaller).

Back to lesson: Practice: Array lab: two passes, write indices, safe removal