Sort Each Row
Return a new 2-D array in which every row of grid has been sorted from smallest to largest. The rows stay in the same order; only the values inside each row move.
Example 1
grid [[3,1,2],[9,8,7]]
returns [[1,2,3],[7,8,9]]
Row 0 becomes [1, 2, 3] and row 1 becomes [7, 8, 9].
Constraints
1 <= rows, columns <= 10
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More NumPy problems
- Strong RowsEasy
- Total Over LimitEasy
- Trend SlopeEasy
- Trimmed MeanEasy
- Vector DistanceEasy
- Weighted AverageEasy
- Weighted Row ScoresEasy
- Whole DollarsEasy