+ 9

# How to check the all possible combinations in array ?

the array is 1 2 3 4 5 1 2 3 4 5 12 13 14 15 23 24 25 34 35 45 123 124 125 134 135 145 234 235 245 345 1234 1235 1245 1345 2345 12345 I want to check this all possible combinations what is the logic for the all possible combinations

6 Answers

+ 15

I do not understand. What combinations? Combinations between them?

+ 10

this will probably help you.
combinations of max 20 chars string
https://code.sololearn.com/cIzIY4CL3m37/?ref=app

+ 6

all possible combinations without repeating the same element of array

+ 1

This post answers your question:
http://stackoverflow.com/questions/3319586/getting-all-possible-combinations-from-a-list-of-numbers

0

In ruby there's the option to do:
list = ['1','2','3','4','5']
list.combination(size).map(&:join)
This will create all possible combinations of the characters given with a length equal to "size"

0

Yes. For 1, 2, 3 and size = 3 the output is 123, 231, 312, etc... until there are no more unrepeated strings