The TransCompilator

Solved LeetCode program · 812 of 1,000

#1051 · Height Checker

Easy Array chunk-17.md

Original English source

The heights is a list of 1, 1, 4, 2, 1, and 3. The ordered is an empty list of whole numbers.
For each height in heights.
Place height into ordered.

Sort ordered. The total is 0.
For every spot from 0 to the last position of heights.
If item spot of heights is not item spot of ordered, add 1 to total.

Show total.

Open in Playground Browse all 1,000 problems

Expected stdout

3