← Unit 4 · all exercises
Saved in this browser only

The largest value

Return the largest number in the array. It always has at least one item, and the numbers may be negative.

int largest(int[] values)

Solution.java
Loading editor…
Results

Examples

  • Solution.largest(new int[]{3, 9, 2}) → 9
  • Solution.largest(new int[]{4}) → 4

There are also 3 hidden tests you can't see. Solve the problem, not the examples.