please can any one solve this question with required code or logic??

Q.The 2010 Census puts populations of 26 largest US metro areas at 18897109, 12828837, 9461105, 6371773, 5965343, 5946800, 5582170, 5564635, 5268860, 4552402, 4335391, 4296250, 4224851, 4192887, 3439809, 3279833, 3095313, 2812896, 2783243, 2710489, 2543482, 2356285, 2226009, 2149127, 2142508, and 2134411.

Can you find a subset of these areas where a total of exactly 100,000,000 people live, assuming the census estimates are exactly right? Please provide the answer and code or reasoning used.
Plz explain what exactly you mean by a subset??How many subsets do you want cuz there could be many.and whats the criteria for selecting a subset? Do you want a subset with least possible number of states touching that population?
@Pterodactyl
Pterodactyl wrote:
How many subsets do you want cuz there could be many
sourabh9890 wrote:
...Can you find a subset...
Pterodactyl wrote:
whats the criteria for selecting a subset
sourabh9890 wrote:
...where a total of exactly 100,000,000 people live...
@Smac89: we can find many subset under that condition. My point is to ask about any other criteria that would specify that "a subset" thing.Or should I find any random subset that fulfills the given condition.There's no point finding any random subset.It makes no sense.But still if u wanna make it, u can. its pretty simple.
hello..basicaly this question is on a webiste.Actally i am applying for android developer job...for that it is complusory submit that question's answer with resume...but i also tried solve that question many times but i didnt got answer..here is the link..
https://opengarden.com/jobs#collapseTwo
sourabh9890 wrote:
hello..basicaly this question is on a webiste.Actally i am applying for android developer job...for that it is complusory submit that question's answer with resume...but i also tried solve that question many times but i didnt got answer..here is the link..
https://opengarden.com/jobs#collapseTwo

Now ,you expect us to get you a job.
This is indeed a good question , an NP type , I was writing up a solution (brute force) to direct you, not now.
That is cheating.
DO some research yourself and solve it yourself.
You might have to look upon:
solving np problems,dynamic programming,integer programming ...
Last edited on

hello..basicaly this question is on a webiste.Actally i am applying for android developer job...for that it is complusory submit that question's answer with resume...but i also tried solve that question many times but i didnt got answer..here is the link..
https://opengarden.com/jobs#collapseTwo

If u r asking us to do ur job work then let me clear u a thing.NOONE'S GONNA FO THAT(or atleast noone should).
Hi All
So, it is a question for send your resume so i cant send the code of this Question Here, But the answer of it is really easy, and if this question have enough time limit this thing can work, lets make the all of possible subsets...
then, ignore the subsets that have only 2 or 3 members(because none of 2 or 3 numbers in this question will have the sum of 100000000.) then lets make a sum of all this subsets and have an if that check there is any 100000000 or not. if there was i think its better to chose the number with the less numbers(i mean the subset that have minimum members).
there is 67108864 subsets at all and i think the best idea for make all of subsets, is using 0 and 1 and Recursive function.
if you know that kind of function so lets do it. and if you do not know it, i'll give the text that show you what should you do.(But its in Persian, because its my math book and also my language is Persian. math book for high school grade 2 Math and Physics courses)
As someone already mentioned, this is an NP (Non-Polynomial) complete problem. I realized this when I tried solving it with a calculator and saw that it started to look more like the Knapsack problem.

A quick search on Google revealed possible solutions to the problem:
http://stackoverflow.com/questions/4632322/finding-all-possible-combinations-of-numbers-to-reach-a-given-sum
http://stackoverflow.com/questions/18305843/find-all-subsets-that-sum-to-a-particular-value

Also recommend watching the video from the first link:
https://www.youtube.com/watch?v=NdF1QDTRkck
thanks to everyone for help and for your usefull tips...
Topic archived. No new replies allowed.