← Unit 4 · all exercises
Saved in this browser only

The smallest value

Return the smallest number in the array. It always has at least one item.

int smallest(int[] values)

Solution.java
Loading editor…
Results

Examples

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

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