Find the maximum element in the given array.
Posted on | Thursday 11 May 2023 | No Comments
Find maximum element from the given array of integers.
Input Format
First line of input contains N - the size of the array and second line contains the elements of the array.
Constraints
1 <= N <= 100
-109 <= ar[i] <= 109
Output Format
Print the maximum element of the given array.
Sample Input 0
5
-2 -19 8 15 4
Sample Output 0
15
code.
a=int(input())
n=list(map(int,input().strip().split()))
print(max(n))
For this problem we can simply use the max() function for the solution.
Comments
Categories
Archives
- May 2023 (30)
Leave a Reply