There is an array, for example:

int array[] = new int[100]; array = {25,25,25,25...}; 

you need to go through all the unique values, that is - {... 25,25,24}; {... 25,25,23}; Brute force takes a very long time ...

  • one
    You can show on a small array what you want to get, just from that example, which is not entirely clear in the description. - Artem Konovalov
  • for example: [2,2,2], [2,2,1], [2,2,0], [2,1,1], [2,1,0], [1,1,1], [1,1,0], [1,0,0], [0,0,0] - Alex
  • one
    not strong in algorithms, but I think to get all sorts of combinations you just need to go through all sorts of combinations. To speed up, I can advise you to parallelize this process. - Artem Konovalov
  • Do you understand that in the case of your array you have exactly 25 ^ 100 or ~ 2 ^ 465 variants? This is substantially more than any variable can express. If you go through 25 ^ 10 options per second, it will take 2 * 10 ^ 118 years to complete. Let me remind you, the universe exists ~ 14 * 10 ^ 9 years. - Nofate

0