+ 1

Anybody tell me the logic to find the mirror image of an array without using another array.

E.g. input 1 2 3 4 Output 2 1 3 4

7th Feb 2019, 3:16 PM
divya murugan
divya murugan - avatar
1 Answer
0
1 is array[0][0], mir_arr[0][1] 2 is array[0][1], mir_arr[0][0] as you can see, the row they are in is same as before, and the column are inversed. In other words, in an array n elements long, the k th colimn changes to the "(n-1)-k" th column in the original array.
8th Feb 2019, 1:14 AM
.cs07
.cs07 - avatar