The TransCompilator

Solved LeetCode program · 962 of 1,000

#1331 · Rank Transform of an Array

Easy Array chunk-20.md

Original English source

Keep a shared numbers as an empty list of whole numbers. Keep a shared position of 0. Place 40 into numbers. Place 10 into numbers. Place 20 into numbers. Place 30 into numbers.

To rank from value (a whole number). Set position to 1.
For every other from 0 to 3.
The candidate is item other of numbers. If candidate is less than value, add 1 to position.

For each value in numbers.
Rank from value. Show position.

Open in Playground Browse all 1,000 problems

Expected stdout

4
1
2
3