Skip to content

Commit 2a576fd

Browse files
committed
added-largest-array-finder
1 parent 10242d1 commit 2a576fd

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Python3 program to find maximum
2+
# in arr[] of size n
3+
4+
def largest(arr, n):
5+
6+
# Sort the array
7+
arr.sort()
8+
9+
# The last element of the
10+
# array is the largest element
11+
return arr[n-1]
12+
# or return arr[-1]
13+
14+
# Driver Code
15+
arr = [10, 324, 45, 90, 9808]
16+
n = len(arr)
17+
Ans = largest(arr, n)
18+
print("Largest in given array ", Ans)

0 commit comments

Comments
 (0)