less than 1 minute read

Given a two-dimensional integer matrix, sort each of the columns in ascending order.

Constraints

  • n, m ≤ 250 where n and m are the number of rows and columns in matrix

https://binarysearch.com/problems/Column-Sort

Examples

Example 1

Input

  • matrix =
[[10,20,30],
 [ 5, 5, 3],
 [ 0,10, 7]]

Output

  • answer = [[0, 5, 3], [5, 10, 7], [10, 20, 30]]

Solution

Leave a comment