Đề bài
Xem bản dịchReturn 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.
Ràng buộc
1 ≤ length ≤ 100,000
Ví dụ
Ví dụ 1
Đầu vào:
numbers = [3, 9, 2]
Kết quả mong đợi:
expected = 2
Đầu vào:
std::vector<long long> numbers = {3, 9, 2};
Kết quả mong đợi:
long long expected = 2;
Đầu vào:
long[] numbers = new long[] {3, 9, 2};
Kết quả mong đợi:
long expected = 2;
Giải thích
2 is smaller than 3 and 9.
Ví dụ 2
Đầu vào:
numbers = [0, -5, 5]
Kết quả mong đợi:
expected = -5
Đầu vào:
std::vector<long long> numbers = {0, -5, 5};
Kết quả mong đợi:
long long expected = -5;
Đầu vào:
long[] numbers = new long[] {0, -5, 5};
Kết quả mong đợi:
long expected = -5;
Giải thích
-5 is the smallest.
Tham khảo
Thử thách này đã được điều chỉnh cho CodeUtility. Hãy làm theo đề bài và các ràng buộc ở trên.