let input = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ]
and i want output should be:
output = {
first: [[1,2], [3,4], [5,6], [7,8], [9,10]],
second: [[1,3], [2,4], [5,7], [6,9], [8,10]],
third: [[1,4], [2,3], [5,8], [7,9], [6,10]],
fourth: [[1,5], [2,6], [3,7], [8,9], [4,10]],
fifth: [[1,6], [2,8], [3,5], [4,9], [7,10]],
sixth: [[1,7], [2,9], [3,6], [4,8], [5,10]],
seventh: [[1,8], [2,7], [4,6], [5,9], [3,10]],
eighth: [[1,9], [3,8], [4,5], [6,7], [2,10]],
ninth: [[1,10], [2,5], [3,9], [4,7], [6,8]],
}
I need to write a code in javascript / typescript / nodejs by which i can put number ranges and will get a combinations of given numbers**( n-1 ), i want a code to be written which can return us **all possible combination and the combination will never conflict with other combinations.
Thanks in advance.