+ 13

[ASSIGNMENT] Rotating a matrix to 90 degrees

Given a matrix represented as int[a][a], Rotate it 90 degrees anticlockwise in-place. ( In place means minimal extra memory to be used, ie, don't make a new array to copy into)? For Example Input : 1 2 3 4 5 6 7 8 9 Output : 3 6 9 2 5 8 1 4 7 Bonus: Rotate it 90 degrees clockwise in-place.

4th Jun 2018, 5:18 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
12 Answers
5th Jun 2018, 5:56 PM
LukArToDo
LukArToDo - avatar
+ 13
A good occasion to train my python list comprehension: the code transforms a matrix in place in many ways. You can change the matrix size at the code's line 3. https://code.sololearn.com/cRMGu3jC6l8D/#py Thanks for this challenge, Pawan. Advice : you should edit your question with [Assignment] in the title to make it more visible. That's the keyword Sololearners are now used to see : )
5th Jun 2018, 11:56 PM
Cépagrave
Cépagrave - avatar
+ 7
4th Jun 2018, 6:25 PM
VcC
VcC - avatar
+ 7
I used a rotating Matrix to solve this Challenge: https://code.sololearn.com/cc6cM7kQqQrM/?ref=app
6th Jun 2018, 6:00 AM
Sebastian at Zielgerade
Sebastian at Zielgerade - avatar
+ 5
yeah! i'm very happy with your question...from past 10 days.i'm studying NUMPY...i have some doubts in SLICING...now i'm clear... thank you for this challange... https://code.sololearn.com/cox43bn4M8bw/?ref=app
6th Jun 2018, 1:30 AM
Hemu@coder
+ 4
[Advice], thank you Cépagrave
6th Jun 2018, 4:06 AM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 3
~ swim ~ yep . you can add ^.-
5th Jun 2018, 7:25 PM
P∆WAN M∆URY∆
P∆WAN M∆URY∆ - avatar
+ 3
yeah! i'm on my way to my first answer
6th Jun 2018, 1:14 AM
Hemu@coder