Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
4-liner: recursive solution in Clear category for Permutation Index by przemyslaw.daniel
def permutation_index(nums):
from math import factorial
return sorted(nums).index(nums[0]) * factorial(len(nums)-1) + \
permutation_index(nums[1:]) if nums else 1
Oct. 4, 2019
Comments: