algorithm - Permutation of a numbers in array to sum a number -


this question has answer here:

i have given array.and want find permutation of array sum specific numbers.
example
array =[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

Popular posts from this blog

javascript - how to protect a flash video from refresh? -

android - Associate same looper with different threads -

visual studio 2010 - Connect to informix database windows form application -