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.
Press Submit to check your solution.
Back to lesson: Practice: Practice: Loops