programming challenge
11–20 of 43 posts
Re: programming challenge
#12The solution given is incorrect. It yields 29 white balls, while the following yields 35. 1 jar1:2 2 3 jar2:3 4 5 6 jar1:2 jar2:4 7 8 9 jar2:6 10 11 12 jar1:11 jar2:3 13 14 15
Yes, I really did imagine all kinds of cases involving zero time and negative time rules (or having zero time to produce anything) and tried to conform them to the spec, but most of them conflict with the output requirements. Not all, though...
Re: programming challenge
#13The solution given is incorrect. It yields 29 white balls, while the following yields 35. 1 jar1:2 2 3 jar2:3 4 5 6 jar1:2 jar2:4 7 8 9 jar2:6 10 11 12 jar1:11 jar2:3 13 14 15
is there a need for jar2:3 at line 12 ?
Re: programming challenge
#14Is there some standard testing package that these are both using? Otherwise it seems fishy.
Re: programming challenge
#15This looks like a really cool challenge. Reminds me a bit of the knapsack problem ( http://en.wikipedia.org/wiki/Backpack_problem ) But something tells me the solution is going to be a lot less simple though.
If you treated this as a variant on the backpack problem, you run into trouble as you can't properly memoize or use dynamic programming. You use 'timesteps' as the size of the 'knapsack' since the number of balls is unbounded. At each timestep, you cannot determine the the optimal solution to the subproblem and you'd have to save every possible ball combination. TL;DR - It gets to be a pretty messy/bad backpack and s…
Re: programming challenge
#16Earlier quoted context omitted.
is there a need for jar2:3 at line 12 ?
Doesn't seem like there is. Also, is my count wrong, or does that only produce 31 white balls? It's still more than the 29, though.
Start producing 4 more (2 jars) at timestep 1.
Start producing 4 more at timestep 6.
Start producing 22 more at timestep 12.
22 + 4 + 4 + 5 = 35
Re: programming challenge
#17The section under "Submission Directions" is exactly the same as the directions here: http://www.facebook.com/careers/puzzles.php verbatim even down to the exact version numbers. Is there some standard testing package that these are both using? Otherwise it seems fishy.
http://www.google.com/search?q=%22All+submissions+must+execu...
Re: programming challenge
#18This looks like a really cool challenge. Reminds me a bit of the knapsack problem ( http://en.wikipedia.org/wiki/Backpack_problem ) But something tells me the solution is going to be a lot less simple though.
So, brute-forcing this looks doable in a day, probably a lot less, as I took a high estimate for the branching factor. One instruction/cycle probably is on the high side, but that can be compensated for by using multiple cores.
Re: programming challenge
#19The section under "Submission Directions" is exactly the same as the directions here: http://www.facebook.com/careers/puzzles.php verbatim even down to the exact version numbers. Is there some standard testing package that these are both using? Otherwise it seems fishy.
Re: programming challenge
#20The solution given is incorrect. It yields 29 white balls, while the following yields 35. 1 jar1:2 2 3 jar2:3 4 5 6 jar1:2 jar2:4 7 8 9 jar2:6 10 11 12 jar1:11 jar2:3 13 14 15