Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 84d6110

Browse files
Height Checker
1 parent f4ea097 commit 84d6110

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
""" https://leetcode.com/problems/height-checker/ """
2+
3+
class Solution:
4+
def heightChecker(self, heights):
5+
count = 0
6+
expectedHeights = sorted(heights)
7+
8+
for i in range(len(heights)):
9+
if (heights[i] != expectedHeights[i]):
10+
count += 1
11+
12+
return count
13+
14+
print(Solution().heightChecker([1,1,4,2,1,3]))

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /