Clan x86

Technical (Development, Security, etc.) => General Programming => Topic started by: warz on February 15, 2009, 03:30:46 am

Title: Facebook Puzzles
Post by: warz on February 15, 2009, 03:30:46 am
Has anyone else attempted any of these Facebook programming puzzles? Location: http://www.facebook.com/jobs_puzzles/index.php

I've submitted several of them but finally got stuck on one. They're pretty fun, though.

I'm stuck on this one, btw: http://www.facebook.com/jobs_puzzles/index.php?puzzle_id=2
Title: Re: Facebook Puzzles
Post by: sdfg on February 15, 2009, 08:27:05 am
I found the one you're stuck on to be pretty straightforward. Basically, find the dollars per pound value for each, compare, then use whatever is least costly.
Title: Re: Facebook Puzzles
Post by: Sidoh on February 15, 2009, 01:16:58 pm
I found the one you're stuck on to be pretty straightforward. Basically, find the dollars per pound value for each, compare, then use whatever is least costly.

This is rather vague.  The part you mentioned is obvious.

This is basically a variant on the subset sum problem.  I would imagine that dynamic programming would probably be the way to go.  (Yes, I realize this is vague too. :))
Title: Re: Facebook Puzzles
Post by: Newby on February 15, 2009, 03:04:50 pm
This is pretty neat. :)
Title: Re: Facebook Puzzles
Post by: warz on February 15, 2009, 03:38:05 pm
I found the one you're stuck on to be pretty straightforward. Basically, find the dollars per pound value for each, compare, then use whatever is least costly.

This is rather vague.  The part you mentioned is obvious.

This is basically a variant on the subset sum problem.  I would imagine that dynamic programming would probably be the way to go.  (Yes, I realize this is vague too. :))

Yea. That's what I basically concluded last night and have been doing some reading on it. I'm going to make another attempt at it soon. Hopefully I don't spend hours on it like I did on some of the others.

Sdfg, your response was pretty obvious. That's pretty much what the exact problem says to do. The word problem isn't where I was stuck, heh.
Title: Re: Facebook Puzzles
Post by: Sidoh on February 15, 2009, 05:44:20 pm
Hehe, yeah.  There's a "pseudo-polynomial" dynamic programming solution to the subset sum decision problem, but it's worth noting that it's still an NP-complete problem.