fb pixel

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 11 21 31 41 12 22 32 42
10 20 30 40 11 21 31 41 12 22 32 42
Can you implement this in a single line of code 😎?
 
To check your solution you need to sign in
Sign in to continue