The problem is this: you have to draw the line width N px as an M-dash.
If, for example, N = 13 and M = 5, our dash will have a width of 2 px, and we will have a 3 px error.
We can do better, we can draw a dash with the following widths: 3, 3, 3, 2, 2. But we can do even better so that the dash can have the following width: 3, 2, 3, 2, 3.
If I have a list a = (3, 3, 3, 2, 2), how can I find such a list that the distance "D" between all the pairs in the list will be maximum?
In this example, D (a) = 0 + 0 + 1 + 0 = 1. For the list b = (3, 2, 3, 2, 3), D (b) = 1 + 1 + 1 + 1 = 4.
What is the fastest / easiest method?
source share