Medium
Given an n x n matrix, rotate it 90 degrees clockwise. LeetCode mutates in place and returns void; here return the rotated matrix.
Input: grid = [[1,2,3],[4,5,6],[7,8,9]] Output: [[7,4,1],[8,5,2],[9,6,3]]
Input: grid = [[1,2],[3,4]] Output: [[3,1],[4,2]]