1
2
3
4
5
6
|
class Solution:
def isMonotonic(self, nums: List[int]) -> bool:
ans=False
if nums == sorted(nums) or nums==sorted(nums,reverse=True) :
ans=True
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 1550. Three Consecutive Odds (0) | 2022.04.04 |
---|---|
leetcode 1800. Maximum Ascending Subarray Sum (0) | 2022.04.04 |
leetcode 1185. Day of the Week (0) | 2022.03.28 |
leetcode 448. Find All Numbers Disappeared in an Array (0) | 2022.03.28 |
Leetcode 268. Missing Number (0) | 2022.03.28 |
댓글