Minimum Number of Operations to Reinitialize a Permutation
You are given an integer n. An array perm of length n is called a permutation of n if it contains all integers in the range [0, n - 1] (inclusive) exactly once. It is considered that the number of operations to reinitialize perm is zero.
On each step, you will create a new array arr of length n and initialize it as follows:
Copying the current array perm into arr. Replacing the value at index i in arr with perm[i]. Return the minimum number of operations to reinitialize perm.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)