Tap here to switch tabs
Problem
Submissions

Problem: Find the Index of Permutation

Try to solve the Find the Index of Permutation problem.

Statement

Given an array perm of length n representing a permutation of the integers from 11 to n, return the 00 based index of perm in the lexicographically sorted list of all permutations of [1,2,…,[1, 2, \dots, n]].

Constraints:

  • 1≤1 \leq n ==== perm.length ≤105\leq 10^5

  • perm is a permutation of [1,2,…,[1, 2, \dots, n]].

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find the Index of Permutation

Try to solve the Find the Index of Permutation problem.

Statement

Given an array perm of length n representing a permutation of the integers from 11 to n, return the 00 based index of perm in the lexicographically sorted list of all permutations of [1,2,…,[1, 2, \dots, n]].

Constraints:

  • 1≤1 \leq n ==== perm.length ≤105\leq 10^5

  • perm is a permutation of [1,2,…,[1, 2, \dots, n]].