Group the numbers
Given an integers, you are asked to group them into
h
rows that contain w
integers.
The first line of the input contains two integers - h
and w
. The next lines contain a single integer each.
The program should print h
rows, which have w
integers.
Input | Output |
---|---|
3 4 | 10 20 30 40 |
Can you implement this in a single line of code 😎?
Tip
Use nested list comprehension to create the groups.
Constraints
Time limit: 2 seconds
Memory limit: 512 MB
Output limit: 1 MB