Problem
Return the smallest value in the list by checking each element once.
Implement array_minimum(numbers).
Input
numbers: A non-empty list of integers.
Output
Return the minimum.
Constraints
1 ≤ length ≤ 100,000
Examples
Example 1
Input:
numbers = [3, 9, 2]
Expected output:
expected = 2
Input:
std::vector<long long> numbers = {3, 9, 2};
Expected output:
long long expected = 2;
Input:
long[] numbers = new long[] {3, 9, 2};
Expected output:
long expected = 2;
Explanation
2 is smaller than 3 and 9.
Example 2
Input:
numbers = [0, -5, 5]
Expected output:
expected = -5
Input:
std::vector<long long> numbers = {0, -5, 5};
Expected output:
long long expected = -5;
Input:
long[] numbers = new long[] {0, -5, 5};
Expected output:
long expected = -5;
Explanation
-5 is the smallest.
References
This challenge is adapted for CodeUtility. Follow the statement and constraints above.