1 Answers

Alain T. On Best Solutions

You can process streets and avenues separately.

For each direction, the optimal position is the one where the total distance to friend homes is the shortest.

For example, if you have a list with friend home streets called homeStreets you can iterate over (total street distances , street number) and pick the tuple with the minimum distance:

minDist,streetNumber = min( (sum(abs(sn-hs) for hs in homeStreets),sn) for sn in range(1,streetCount+1) )

you can use the same approach with avenues.