Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
no factorial solution in Clear category for Reversed Permutation Index by karlian
from typing import Iterable
def reversed_permutation_index(length: int, index: int) -> Iterable[int]:
q, result = index - 1, [0] * length
for d in range(1, length + 1):
q, i = divmod(q, d)
result[length - d] = i
return map(list(range(length)).pop, result)
July 13, 2022
Comments: