Leetcode

Leetcode 1051. Height Checker

2021-02-19  本文已影响0人  SnailTyan

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

1. Description

Height Checker

2. Solution

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/
上一篇下一篇

猜你喜欢

热点阅读