Permutation Operations

Problem Overview

  • Determine the minimum number of permutation operations (at least 1) needed so that repeatedly applying a given permutation p to an arbitrary array of n distinct elements returns the array to its original order.
  • Input: permutation p of size n (1 ≤ n ≤ 1e5). Output: count of required operations modulo 1e9+7.
  • Domain: permutations and array reindexing in discrete math.
  • This coding interview problem is a Wolverine_trading interview question.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: