leetcode

Description:

leetcode-1051

Submission:

1
2
3
4
5
6
7
8
9
class :
def heightChecker(self, heights: List[int]) -> int:
l = len(heights)
sorted_heights = sorted(heights)
ans = 0
for i in range(l):
if (heights[i] - sorted_heights[i] != 0):
ans += 1
return ans

Acceptance:

ac

(ーー゛),好慢,为什么这么慢。。。