0

I have some trouble with generating all variants of arrays from a number. For example if I have the number 3, I need to get the following arrays:

[1].
[2],
[3],
[1, 2],
[1, 2, 3],
[1, 3]

Order of the numbers in the arrays does not matter.

full-stack
  • 553
  • 5
  • 20
  • 1
    Please post what you have tried so far....also keep in mind this answer with a variety of ways of doing this can be found on SO already. – Matt Jun 18 '18 at 16:02
  • You are looking to calculate the [power set](https://en.wikipedia.org/wiki/Power_set). Perhaps that terminology will help you find the answer now. You are also missing `[2, 3]` in your example. – plalx Jun 18 '18 at 16:09

0 Answers0