Hi all,
My doubt is, how to generate all possible combinations of elements from a given list and assign each combination a unique group ID? Here are some examples
Input 1:
| Value |
| A |
| B |
Output 1:
| GroupID | Value |
| 1 | A |
| 1 | B |
| 2 | A |
| 3 | B |
Input 2:
| Value |
| A |
| B |
| C |
Output 2:
| GroupID | Value |
| 1 | A |
| 1 | B |
| 1 | C |
| 2 | A |
| 2 | B |
| 3 | A |
| 3 | C |
| 4 | B |
| 4 | C |
| 5 | A |
| 6 | B |
| 7 | C |
OBS: The real case input right now has 15 values, and it should generate 32767 groups (2^n-1).
Thanks.
Solved! Go to Solution.
@JackTequila
I was not really considering the computing cost, and I guess I need to keep that in mind. 😁
@SPetrie gives very good one and I will definitely going to study it. Thanks.
@SPetrie
Maybe you should submit this as an idea for weekly challenge. 😂
