can a generic code be written to transpose a matrix in o(1) space of an n*n matrix
Image rotation problem doubt
sir provide code for it
Hi @RishabhSingh, see you just need to observe what is happening. Pls do not ask for code so quick. Do one thing. Take a pen and paper and write down a 4*4 matrix, its elements. Then write down another matrix which contains i,j at every like this:
(0,0) (0,1) (0,2) …
(1,0) (1,1) …
…
Now write the matrix 90* rotated anti-clockwise.
And after that the (i,j) matrix for the above rotated matrix. Like this:
(0,3) (1,3) (2,3) …
(1,0) (1,1) …
…
Now observe the pattern. Hope this helps
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.