18 lines
464 B
Python
18 lines
464 B
Python
class Solution:
|
|
def canBeIncreasing(self, nums: List[int]) -> bool:
|
|
bad = 0
|
|
for i in range(1, len(nums)):
|
|
if nums[i] <= nums[i - 1]:
|
|
bad += 1
|
|
|
|
if bad > 1:
|
|
return False
|
|
|
|
l = i == 1 or nums[i] > nums[i - 2]
|
|
r = i == len(nums) - 1 or nums[i + 1] > nums[i - 1]
|
|
|
|
if not l and not r:
|
|
return False
|
|
|
|
return True
|