How do you rotate a two dimensional array?
O(n^2) time and O(1) space algorithm ( without any workarounds and hanky-panky stuff! ) Rotate by +90: Transpose Reverse each row Rotate by -90: Method 1 : Transpose Reverse each column Method 2 : Reverse each row Transpose Rotate by +180: Method 1: Rotate by +90 twice Method 2: Reverse each row and then reverse … Read more