how to reverse the elements of a two dimensional array | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

how to reverse the elements of a two dimensional array

26th Jan 2017, 6:00 PM
Akash Rawat
Akash Rawat - avatar
4 Answers
+ 5
Do you mean this: {{1,2,3},{4,5,6}} -> {{6,5,4},{3,2,1}} or this: {{1,2,3},{4,5,6}} -> {{3,2,1},{6,5,4}} or something else?
27th Jan 2017, 2:14 AM
J.G.
J.G. - avatar
+ 3
@Vova Denys - I see what you're getting at there; have you found CodePlayground (or maybe have your own compiler set up)?
27th Jan 2017, 1:52 AM
Kirk Schafer
Kirk Schafer - avatar
+ 2
@Akash... I looked at your "Codes". You have one that reverses a 1D array; could you not apply the same concept per row?
27th Jan 2017, 1:48 AM
Kirk Schafer
Kirk Schafer - avatar
0
maybe for(i=rows, i<=0,i--) for(i=cols, i<=0,i--)
26th Jan 2017, 11:39 PM
Vova Denys
Vova Denys - avatar