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.
2 parents 3eb4e8e + 3a2d2ef commit 1960fc2Copy full SHA for 1960fc2
Python/CheckForUnimodalArray.py
@@ -0,0 +1,25 @@
1
+n = int(input())
2
+l = list( map(int,input().split()))
3
+j = 0
4
+i = 0
5
+a = max(l)
6
+max_index = l.index(max(l))
7
+for i in range(0,n-1):
8
+ if l[i] < l[i+1] :
9
+ j = j+1
10
+ else :
11
+ break
12
+for i in range(i,n-1) :
13
+ if l[i] == l[i+1] :
14
15
16
17
18
+ if l[i] > l[i+1] :
19
20
21
22
+if j == n-1 :
23
+ print("YES")
24
+else :
25
+ print("NO")
0 commit comments