+ 27

how to get all possible combination from a set of integers and print in ascending order?

input: 1 2 output: 1 2 12 21

22nd Jan 2017, 12:41 AM
Jobelle
Jobelle - avatar
3 Answers
0
range of integers? number of integers? is 1+22 in front of 1+1+3?
22nd Jan 2017, 12:49 AM
DFX
DFX - avatar
0
Simple- take a cartesian product of the sets and then order them by the leading element of the ordered pairs.
22nd Jan 2017, 6:25 AM
Michael Timbes
Michael Timbes - avatar
0
Here you go: https://code.sololearn.com/cI9pn9700N56 (use comb_all(); )
22nd Jan 2017, 8:45 PM
Robobrine
Robobrine - avatar