-2

i want to reverse 2-dimension array so if i have

    int [,] Y = new int [3,4] {
                               {0, 1, 2, 3} ,  
                               {4, 5, 6, 7} ,  
                               {8, 9, 10, 11}   
};

how i can make the reverse of this array to be like

                                {3, 7, 11}
                                {2, 6, 10}
                                {1, 5, 9}
                                {0, 4, 8}

i just wanna know the logic in any language

Gilad Green
  • 35,761
  • 7
  • 54
  • 89
selly
  • 1

1 Answers1

0

You just have to map the [i][j] element of the first array to the [M-1-j][i] element of the second array, where M is the number of columns.

blue_note
  • 25,410
  • 6
  • 56
  • 79