Not sure if I understood your reply...
The answer is correct (it was accepted by the site).
You could use a multidimensional array, but it unnecessary. Take the sample output:
3
7 4
2 4 6
8 5 9 3
It becomes the following list:
[3,7,4,2,4,6,8,5,9,3]
Knowing the row...