How to get the all possible combinations in an array. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to get the all possible combinations in an array.

There is array1 with 5 element and we have to select 3 Out of 5 elements from array1 such that all possible combination from array1 is in array 2(no repetition of elements). Eg i/p array1={1, 2, 3, 4} o/p array2={{1, 2, 3},{2, 3, 4}{3, 4, 1}{4, 1, 2}}

9th Feb 2020, 4:28 AM
հíʍɑղՏհմ
հíʍɑղՏհմ - avatar
1 Answer