-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathValid Mountain Array.py
More file actions
22 lines (22 loc) · 885 Bytes
/
Valid Mountain Array.py
File metadata and controls
22 lines (22 loc) · 885 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
class Solution:
def validMountainArray(self, A: List[int]) -> bool:
for i in range(len(A)):
if len(A) > 2:
max_integer = max(A)
max_index = A.index(max_integer)
A_array1 = A[:A.index(max(A))+1]
A_array2 = A[A.index(max(A)):]
if len(A_array1) > 1 and len(A_array2) > 1:
for i in range(len(A_array1)-1):
if A_array1[i] < A_array1[i+1]:
pass
else:
return False
for i in range(len(A_array2)-1):
if A_array2[i] > A_array2[i+1]:
pass
else:
return False
return True
else:
return False