How to align two lists of numbers
问题 I have two sorted lists of numbers A and B with B being at least as long as A . Say: A = [1.1, 2.3, 5.6, 5.7, 10.1] B = [0, 1.9, 2.4, 2.7, 8.4, 9.1, 10.7, 11.8] I want to associate each number in A with a different number in B but preserving order. For any such mapping we define the total distance to be the sum of the squared distances between mapped numbers. For example: If we map 1.1 to 0 0 then 2.3 can be mapped to any number from 1.9 onwards. But if we had mapped 1.1 to 2.7, then 2.3