The TransCompilator

Solved LeetCode program · 988 of 1,000

#1365 · How Many Numbers Are Smaller Than the Current Number

Easy Array chunk-20.md

Original English source

Keep a shared numbers holding 8, 1, 2, 2, and 3. Keep a shared smaller of 0. Keep a shared target of 0.

To tally. Set smaller to 0.
For each other in numbers.
If other is less than target, add 1 to smaller.

The answers is an empty list of whole numbers.
For each value in numbers.
Set target to value. Tally. Place smaller into answers.

The line is empty text.
For each count in answers.
If the length of line is more than 0, Place "," into line. Place format whole number count as text into line.

Show line.

Open in Playground Browse all 1,000 problems

Expected stdout

4,0,1,1,3