3 ms·
A more generalized version of the problem was posted as a practice question in Google's codejam contest: http://code.google.com/codejam/contest/32003/dashboard
by tomerv 14y ago
A more generalized version of the problem was posted as a practice question in Google's codejam contest:
http://code.google.com/codejam/contest/32003/dashboard#s=p2 http://code.google.com/codejam/contest/32003/dashboard#s=p2
I suggest solving this version of the problem, as it forces you to look at the problem from various perspectives. If you're stuck you can download solutions from the dashboard (link in top right corner).