Solutionunvalidated

The greatest length of the solution seems be the size of the problem minus the number of values that can't be used. Tension: you may have plenty of solutions for the same input. Outcome: for [1,1,1,2,2,2,2,3,3,3] you are losing 1 "1", 1 "3" and you can only use 3 of the 4 "2", so max is 7.

7986c189-1440-4daf-a2ba-389d0382e1b3

The greatest length of the solution seems be the size of the problem minus the number of values that can't be used. Tension: you may have plenty of solutions for the same input. Outcome: for [1,1,1,2,2,2,2,3,3,3] you are losing 1 "1", 1 "3" and you can only use 3 of the 4 "2", so max is 7.