I'll try to formulate my problem through an example.Lets suppose we have a collection of items of type a,b,c,d,e,f.a1, a5, a7b2, b3c5, c6, c7, c8d4, d5e1, e2, e3f3, f7, f8If we take one element from each type there are 3*2*4*2*3*3 abcdef lines (combinations).We have another random line a1b5c7d1e5f7.I want to count how many from the combinations lines differ by the current line in exactly 3 elements. I.e these lines differ only in one (the first) elementa5b5c7d1e5f7a8b5c7d1e5f7I want to do that if it's possible without generating and comparing each combination.
Count combinations differing by fixed number of elements
algorithms;combinatorics