美文网首页Leetcode
Leetcode 1051. Height Checker

Leetcode 1051. Height Checker

作者: SnailTyan | 来源:发表于2021-02-19 08:44 被阅读0次

    文章作者:Tyan
    博客:noahsnail.com  |  CSDN  |  简书

    1. Description

    Height Checker

    2. Solution

    • Version 1
    class Solution:
        def heightChecker(self, heights):
           count = 0
           result = sorted(heights)
           for i in range(len(heights)):
               if heights[i] != result[i]:
                   count += 1
           return count
    

    Reference

    1. https://leetcode.com/problems/height-checker/

    相关文章

      网友评论

        本文标题:Leetcode 1051. Height Checker

        本文链接:https://www.haomeiwen.com/subject/trhnxltx.html