Skip to main content

Practice ยท 2 of 5

Max value AND its position

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.

Difficulty: beginner

Back to lesson: Practice: Practice: Loops