algorithm - Permutation of a numbers in array to sum a number -
this question has answer here:
- how count possible combination coin problem 14 answers
i have given array.and want find permutation of array sum specific numbers.
examplearray =[2,3,5 ,1]
target = 8
`solution: [2,2,2,2] ,[5,3] ,[3,3,2] ,[5,2,1] , possible combination
please provide me approach solve problem , problem facing how handle repetition of elements.target large number of 10^6. think same asthis theory
you facing typical subset problem. worst case complexity of problem exponential no matter how put it. might find polynomial-time approximations work wonders average case though.
Comments
Post a Comment