Practice · 2 of 5
Transpose
CHALLENGE
Difficulty: beginner+25 XP
Implement transpose(int[][] g): return a new grid where result[c][r] == g[r][c] — rows become columns. Build the result with new int[g[0].length][g.length].
Press Submit to check your solution.
Back to lesson: Practice: 2D array reps