Previous Next
0 / 21
Module DEMO-32-109DEMO-C-32

Sort Rows

DEMO-C-32 โ€ข Programming in C

Browser-only practice

Problem Statement

Write a program to sort each row of a matrix in ascending order independently.

Constraints

1 <= N, M <= 10. Integers within standard range.

Input Format

Input: Dimensions N M followed by the matrix elements.

Output Format

Output: The formatted result as specified.

Sample Testcases

Submit runs every public testcase in this browser. Results and code never leave this device.

Sample #1
Public sample
3 3
5 -3 20
31 7 -7
30 1 20
-3 5 20
-7 7 31
1 20 30
Sorted each row in ascending order.
Sample #2
Public sample
5 2
29 49
0 10
24 9
49 43
32 11
29 49
0 10
9 24
43 49
11 32
Sorted each row in ascending order.
Sample #3
Public sample
5 2
34 44
34 46
30 22
33 -7
6 14
34 44
34 46
22 30
-7 33
6 14
Sorted each row in ascending order.
Sample #4
Public sample
4 5
44 47 39 40 2
25 33 19 50 31
-4 31 5 -3 34
28 33 -3 30 45
2 39 40 44 47
19 25 31 33 50
-4 -3 5 31 34
-3 28 30 33 45
Sorted each row in ascending order.

Web terminal

C, C++, Java, and Python run locally in a browser VM. No worker or visualizer is used.

Saved in this browser
Editor settings