Premium problem59. Sort by nth Column

Medium Locked

Sort the rows of matrix Z by the values in its n-th column. Return the sorted matrix.

Input

Z =
[[3 7 1]
 [1 2 9]
 [2 5 5]]
n = 1

Output

[[1 2 9]
 [2 5 5]
 [3 7 1]]

Premium problem

This one's part of Premium. Unlock the full NumPy track plus every other premium problem on the site.

Implement solve(...)