Challenge: Arranging the matrix elements. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Challenge: Arranging the matrix elements.

Given an input eg. {1,2,3,4,5,6,7,8,9} The output should be like- 1 3 6 2 5 8 4 7 9 Any language. One can consider a 3 x 3 matrix for instance. But the best answer would be a N x N program.

17th Nov 2017, 4:04 PM
Sagar Wankhede
Sagar Wankhede - avatar
5 Answers
+ 2
And Heres my Answer## (includes default / sample inputs) JUST RUN AND WATCH #####BONUS==>> (( works with rectangular matrix too like m×n....Default is set as m=n [means square mtrx] )) https://code.sololearn.com/caXXAQCLsoU5/?ref=app
17th Nov 2017, 6:59 PM
sayan chandra
sayan chandra - avatar
+ 2
I will work on this after work, I actually have a very similar code that does almost the same thing if you want to check it out https://code.sololearn.com/c6NSydL4yhF9/?ref=app
17th Nov 2017, 9:26 PM
Vari93
Vari93 - avatar
+ 2
Great coding guys! as expected 😎@sayan chandra and i loved😍 that Zig-Zag matrix too!@Vari93 Didn't expect the results so early😁 Thanks for the Bonus😄
18th Nov 2017, 1:44 AM
Sagar Wankhede
Sagar Wankhede - avatar
26th Nov 2017, 7:58 AM
Dathi Sai Pavan Kumar
Dathi Sai Pavan Kumar - avatar
0
Take any random input from user like 8 4 5 2 1 3 6 7 9 and output 8 5 3 4 1 7 2 6 9 You see it has a pattern! How'd you loop this!
17th Nov 2017, 6:01 PM
Sagar Wankhede
Sagar Wankhede - avatar