We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ded6c69 commit af3c6b9Copy full SHA for af3c6b9
max_in_array.py
@@ -0,0 +1,10 @@
1
+def maxIndex(arr):
2
+ max_index = 0
3
+ for i in range(1, len(arr)):
4
+ if arr[max_index] < arr[i]:
5
+ max_index = i
6
+ return max_index
7
+
8
+arr = [4,5,6,7,8,1,2,11,12,13,3,9,10]
9
+res = maxIndex(arr)
10
+print("maximum element is", arr[res],"at index:", res)
0 commit comments