How to solve Leetcode 867. Transpose Matrix