Arrays-is second array mirror inverse of first array

How is the sample input returning true? According to me the reverse of array1 : {4, 0, 2, 1, 3} should be {3, 1, 2, 0, 4}. However in the question it is : {1, 3, 2, 4, 0}
Am I interpreting the question wrong?

Here is my code btw: https://ide.codingblocks.com/#/s/13693

Hy Akriti,
The question asks you to find INVERSE of the array not REVERSE of the array.
Inverse of the array means the array which you will get by inserting position of an element at the position specified by the element value in the array.

Oh I got it! Thank you.
I passed all the test cases except this one… I guess the test cases should be more diverse.

1 Like

Great!!! This is one of the finest questions on arrays