Solution 1 - Sort and Compare
Count indices where heights differ from sorted copy.
""" 1051.1 - Height Checker - Solution 1 - Sort and Compare """
from typing import List
class Solution:
def heightChecker(self, heights: List[int]) -> int:
expected = sorted(heights)
return sum(1 for a, b in zip(heights, expected) if a != b)