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

python - Referencing Data From a 2D Histogram -

c# - Derived UserControl layout resets after build -

php - MySQL LIMIT results with INNER JOIN with more than 2 tables -