123456789101112131415 |
- class Solution:
- def peakIndexInMountainArray(self, A):
- # return the peak of the mountain... i.e Where the array starts going down in value
- last = -1
- for ind, n in enumerate(A):
- if n < last:
- return ind - 1
- last = n
-
- # This should never happen
- return -1
-
- s = Solution()
- print("Expected: 1")
- print("Got:", s.peakIndexInMountainArray([0, 2, 1, 0]))
|