โจทย์
ดูฉบับแปล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.
เงื่อนไข
1 ≤ length ≤ 100,000
ตัวอย่าง
ตัวอย่างที่ 1
อินพุต:
numbers = [3, 9, 2]
ผลลัพธ์ที่คาดหวัง:
expected = 2
อินพุต:
std::vector<long long> numbers = {3, 9, 2};
ผลลัพธ์ที่คาดหวัง:
long long expected = 2;
อินพุต:
long[] numbers = new long[] {3, 9, 2};
ผลลัพธ์ที่คาดหวัง:
long expected = 2;
คำอธิบาย
2 is smaller than 3 and 9.
ตัวอย่างที่ 2
อินพุต:
numbers = [0, -5, 5]
ผลลัพธ์ที่คาดหวัง:
expected = -5
อินพุต:
std::vector<long long> numbers = {0, -5, 5};
ผลลัพธ์ที่คาดหวัง:
long long expected = -5;
อินพุต:
long[] numbers = new long[] {0, -5, 5};
ผลลัพธ์ที่คาดหวัง:
long expected = -5;
คำอธิบาย
-5 is the smallest.
แหล่งอ้างอิง
โจทย์นี้ปรับให้เหมาะกับ CodeUtility กรุณาทำตามคำชี้แจงและข้อจำกัดด้านบน