All prompts are owned by LeetCode. To view the prompt, click the title link above.
First completed : February 02, 2025
Last updated : February 02, 2025
Related Topics : Array
Acceptance Rate : 54.95 %
class Solution:
def check(self, nums: List[int]) -> bool:
allowance_used = False
for i, j in zip(nums[:-1], nums[1:]) :
if i <= j :
continue
if allowance_used :
return False
allowance_used = True
return not allowance_used or (nums[0] >= nums[-1])