Replace 0 in a diagonal matrix with 1 one at a time or 3 at a time

Thank you the reply. But that permutation done on the actual list of 42 elements choosing 3 elements at a time only did generate the lists, but upon trying to turn it into an array using the diagonal matrix crashed the computer.

I might have to change my approach. My initial approach was to dot product the arrays with 1 and 0s with a list of same length containing values. That values has to be maximized using the maximize function.

I might have to re think the entire process.

DO you have any tips on how to approach this problem? I posted the initial problem here