Here is the tip:
- Assuming you have 5 numbers [1 2 3 4 5]
- There are 4 places to insert space [1-2, 2-3, 3-4, 4-5]
- 4-digit binary number represents combination (0 - no space, 1 - space)
- For example: code 0110 matches [1 (0) 2 (1) 3 (1) 4 (0) 5] == [12 3 45]
- Iterate through all n-1 binary codes.