Home > Back-end >  Brute force problem
Brute force problem

Time:09-17

Now there are n people, everyone in the m options, select a different people can choose the same option, put each person's choice in a length of n array arr, arr [I] value means the personal choice is which I option, and then to exhaustion of all possible situations, and to the use of each case f (int arr []) for processing, this how to write?
I tried with n layer for loop and recursive, but when n is larger, the for loop will layer number is too much, the recursion will collapse directly, is there not a better algorithm to implement?

CodePudding user response:

I feel can use N, M hexadecimal number,,,,,,,

CodePudding user response:

Two options, such as eight people but is a hexadecimal 8-bit 2 problem
From
Please input from 00000000 to 11111111, and in order to,

CodePudding user response:

Loop at a time
  • Related