Here I have an array of arrays of bits. I need to generate non-repeating arrays of bits in the first array. There can be any given number of bits in an array (for example, set 10 and arrays with 10 bits will be generated). The bits can be repeated, but the bit arrays themselves are not. How to implement it?

  • What is the maximum length of an array of bits? How many such arrays need to be generated, 1,2, 5 or all possible? If all possible then you have the classic combinatorial problem of generating permutations of a given length with repetitions. If the maximum length of an array of bits is limited to 64 pieces, then you can easily use the uint64 type and put the numbers into a binary system. - teran
  • @teran I wrote that the variable sets the length, i.e. it may be different. I need to generate everything possible, and then filter out some of them using my algorithm - Minebot
  • and I did not ask what exactly the length should be. I asked what is the maximum length. - teran
  • @teran A, 32 most likely - Minebot
  • one
    expanding all the numbers from 0 to 2^N (where N length of the array) in binary form, you get a complete set of all possible arrays of interest to you. Moreover, it is possible with the help of bit operations, you can filter out the necessary numbers according to your algorithm. For example, throw out arrays, where we say the third bit is zero. - teran

0