The TransCompilator

Solved LeetCode program · 60 of 1,000

#0060 · Permutation Sequence

Hard Math chunk-02.md

Original English source

The size is 3. The rank is 3. Decrease rank by 1. The available is an empty list of whole numbers.
For every digit from 1 to size.
Place digit into available.

The block is 1.
For every step from 2 to size minus 1.
Set block to block times step.

The result is empty text. The last is size minus 1.
For every position from 0 to last.
The index is rank divided by block. Set rank to rank modulo block. The chosen is item index of available. Remove item index of available. Place the character for chosen into result. If position is less than last, set block to block divided by (last minus position).

Show result.

Open in Playground Browse all 1,000 problems

Expected stdout

213