Given an array of length N, find the minimum value within the array A.
This is a function call problem. There will be no input and output. You are supposed to implement the following functions:
int findMin(int N, int A[])
, which returns the minimum value within array A of length N.
Your function will be called with two parameters, N, the number of elements in the array, and A[], the array itself.
Your function should return an integer, the minimum number found in array A[]
0 <= A[i] <= 2 000 000 000
Subtask 1 (15%): 1 <= N <= 1 000
Subtask 2 (35%): 1 <= N <= 1 000 000
Subtask 3 (50%): 1 <= N <= 10 000 000
findMin(2, [3, 5]);
The function will return 3.
findMin(5, [1, 5, 2, 3, 10]);
The function will return 1.
Subtask | Score |
---|---|
1 | 15 |
2 | 35 |
3 | 50 |