educative.io

Can we just fil the array with 1, 2, 3, 4 ... n?

If the input array has unique numbers from 1 to n and the array has length n, can we just fill the array with 1,2,3,4,5…n in order ?

No, we can’t because of the following reason stated in the problem definition:

For simplicity, let’s assume we are passed an integer array containing only the sequence numbers, though each number is actually an object.