DEV Community

Discussion on: Interview Prep #6: Rotate Image

Collapse
 
godcrampy profile image
Sahil Bondre

Yea, your solution will work as well. It's just that it will take additional O(n2) space as we are creating a new matrix. The pattern that you mentioned is indeed what the algorithm mentioned by me does. But, since it tries to do in-place, we rotate one number of row/column at a time.