1
2
3
4
5
6
7
|
class Solution:
def heightChecker(self, heights: List[int]) -> int:
compare=sorted(heights)
ans=0
for i in range(len(heights)):
if heights[i]!= compare[i]: ans+=1
return ans
|
cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 2057. Smallest Index With Equal Value (0) | 2022.03.21 |
---|---|
leetcode 2154. Keep Multiplying Found Values by Two (0) | 2022.03.21 |
leetcode 1351. Count Negative Numbers in a Sorted Matrix (0) | 2022.03.20 |
leetcode 290. Word Pattern (0) | 2022.03.17 |
leetcode 1455. Check If a Word Occurs As a Prefix of Any Word in a Sentence (0) | 2022.03.17 |
댓글