logo
Interview
    Interview Guide
    Coding Problems List
Sponsored: Coursera
Problems

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.

Online Judge