Unicorns VO Interview Coding Question: Rotate an Image 90 Degrees Clockwise

13 Views
No Comments

Rotate an image 90 degrees clockwise.

from typing import List

def rotate_image(image: List[List[int]]) -> List[List[int]]:
    pass

This problem asks you to rotate a 2D matrix 90 degrees clockwise. The key idea is to remap each element from position <code>(i, j)</code> to its new position after rotation, or to use a classic in-place approach by transposing the matrix and then reversing each row. It mainly tests matrix manipulation and coordinate transformation.

END
 0