Java code for arranging blocks in rectangular area -


I want to arrange equal size blocks in a rectangular area such as

Enter image details here

should be number of input blocks and output should be (n1, n2, N3 ...) where n1 is the number of blocks 1 and so on ....

For example, for the above image (2,3,2) will be for input 7.

Is there some library to achieve this? I want the hurdle to arrange at least rows with each line of the same width. I also want that there should not be more than 4 images in any rows.

With the given information, this is happening for example to be a custom job if I Only 7 blocks were given that you have mentioned that I can end with (2,3,2) like you did (2,2,3) or (3,2,2) or (4,2) , 1), etc.

With a mathematically well-formed solution, you want to make it more compelling. As the following rows do not have as many rows, the rows are added in the following sequence, new rows can not be inserted between existing rows etc.

It is possible to write such algorithms from scratch, but you need to interrupt the probes as much as you describe, the more it is to work for it.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -