Quantcast
Channel: CodeChef Discuss - latest questions
Viewing all articles
Browse latest Browse all 40121

Number of ways of selecting the numbers

$
0
0

Suppose i am given an array and a sum.I am asked to find the number of ways in which i can select the numbers from the given list(one number can be used any number of times) so that i can achieve the sum by adding all the selected numbers from the array Eg: arr[]={2,3} and sum=6 then we can select the numbers like {2,2,2},{3,3} and here i guess the count is 2....} I felt that this is a question related to DP.I have just heard of DP.I know nothing on DP.I am just a newbie.Can you please explain it? I tried to Brute Force it....And the result was a failure..:( Advance Thanks...:)


Viewing all articles
Browse latest Browse all 40121

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>