Untitled
unknown
python
2 years ago
333 B
6
Indexable
Never
def has132Pattern(nums): n = len(nums) # O(n^2) for i in range(n-1): maxim = nums[i+1] for k in range(i+2, n): if nums[i] < nums[k] < maxim: return True maxim = max(maxim, nums[k]) # i < j < k : nums[i] < nums[k] < nums[j] return False