0

How could characters be arranged so that it will match separate lines? (python)

For example if given 7123724271379220 output must be something like this 7123 7927 3022 1724 any spiral or zikzak form as long as identical characters line up and the original sequence remain adjacent to each other. And how could code be written to ensure the most lined op characters.

30th May 2018, 12:39 PM
Andries van der Walt
2 Respostas
+ 2
Put the series into a set pattern and count how many matches you get, repeat this for every pattern you support. Pick the one that has the highest match count and print it.
30th May 2018, 5:25 PM
John Wells
John Wells - avatar
0
create a 2D array, fill it in the desired order and then print it
30th May 2018, 3:16 PM
michal