Skip to main content

Practice · 2 of 5

Max value AND its position

CHALLENGE
Difficulty: beginner+25 XP

Implement int[] maxWithIndex(int[] values) returning {max, index} of the FIRST occurrence of the largest value. Return new int[]{-1, -1} for an empty array.

Back to lesson: Practice: Practice: Loops