Home > Back-end >  The length of the array for m, remove any of n elements of subarray, as two child elements in the ar
The length of the array for m, remove any of n elements of subarray, as two child elements in the ar

Time:10-01

Reference
the length of the array for m, remove any of n elements of subarray, as two child elements in the array can't more than 2 repeating

Such as: m=8,,2,3,4,5,6,7,8 {1}, remove n=4 subarray,
Conform to the child not more than 2 repeating elements in the array digital conditions are: {1, 2, 3, 4}, {1,2,5,6}, {1,2,7,8}, {1,3,6,8}, {1,4,5,8}, {1,4,6,7}...
Do not conform to the conditions of subarray are:,2,3,5 {1}, {5}... Because these Numbers of the array elements repeated more than two

If m=100 has a length of the array {1, 2,... 10, 100}, remove the length of the subarray, output meet the child digital elements in the array is not more than two repeat all child array, how to implement this algorithm?


Whether there are many, such as subject of example
Reference
is not in conformity with the conditions of subarray are:,2,3,5 {1}, {5}.

If I put,2,4,8 {1} {5} instead, then on the basis of these, a line on the {1, 2, 3, 4} are beyond the scope of this standard in accordance with the

So the title is to output a variety of situations

Or C (8, 4)=70, 70 in the case, as much as possible to pick some array, meet as two child elements in the array can't more than two repeat?

In addition, this question should be how to write
8 pick four, for example, is divided into two and a half first, and then each group choose two like this?

{1, 2, 3, 4}, {5,6,7,8}
{1, 2} {5, 6}, {5, 7} {5, 8} {6, 7} {6, 8} {7, 8}
{3, 4} {5, 6}, {5, 7} {5, 8} {6, 7} {6, 8} {7, 8}


Next:c
  • Related