当前位置: 代码迷 >> 综合 >> Leetcode 1051. Height Checker
  详细解决方案

Leetcode 1051. Height Checker

热度:75   发布时间:2023-12-12 21:10:56.0

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

1. Description

Height Checker

2. Solution

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

Reference

  1. https://leetcode.com/problems/height-checker/
  相关解决方案