введите здесь описание изображения
Код: Выделить всё
class Solution(object):
def validMountainArray(self, arr):
"""
:type arr: List[int]
:rtype: bool
"""
list=[]
for i in arr:
if i not in list:
list.append(i)
if len(list)==len(arr):
maxi=max(arr)
index=arr.index(maxi)
if arr[:index]==arr[:index].sort() and arr[index:]==arr[index:].sort(reverse=True):
return True
expected True
output False
why? where is the problem lies?
Источник: https://stackoverflow.com/questions/781 ... eed-help-t