1D to 2D conversion problem# Programming - 葵花宝典
j*k
1 楼
Suppose there is a 1D array, we need convert it into a 2D array. Here is the
conditions/requirements:
Already known about 1D array:
1: 1D array can have any number of elements.
2: 1D array can be padded.
Requirements:
1: The 1D array needs least padding.
2: After the conversion, the number of rows of the 2D array should be as
close to the number of columns as possible.
3: The number of rows / the number of columns needs to be even. It's best to
be a power of 2.
Any idea?
conditions/requirements:
Already known about 1D array:
1: 1D array can have any number of elements.
2: 1D array can be padded.
Requirements:
1: The 1D array needs least padding.
2: After the conversion, the number of rows of the 2D array should be as
close to the number of columns as possible.
3: The number of rows / the number of columns needs to be even. It's best to
be a power of 2.
Any idea?