Permutation Index
Problem
Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical order. The index begins at 1
.
Example
Given [1,2,4]
, return 1
.
Given a permutation which contains no repeated number, find its index in all the permutations of these numbers, which are ordered in lexicographical order. The index begins at 1
.
Given [1,2,4]
, return 1
.