In the comments section of a recent
[[http://www.codinghorror.com/blog/2010/02/the-nonprogramming-programmer.html][Atwood
post]], commentor Paul Jungwirth (search for the name as I can't find
comment permalinks) posted about a problem from a
[[http://www.mail-archive.com/boston-pm@mail.pm.org/msg00100.html][perl
mailing list]] that he would give potential hires. This post is not
about the blog post but about the problem from the comments section.
*The Problem* (from the mailing list): Consider the following string: 1
2 3 4 5 6 7 8 9 = 2002 The problem is to add any number of addition &
multiplication operations wherever you'd like on the left such that in
the end you have a valid equation. So for example if it gets you to a
solution you can have: 12 * 345 + 6 ... if that works as part of your
solution [it's much too big: 4146]. Bearing in mind that multiplication
takes higher precedence than addition, what is the solution? My answer
generator can be found
[[http://github.com/jamesaimonetti/ProjectEuler/blob/master/prob.erl][here]]
in Erlang. I liked the problem because it is in the vein of
[[http://projecteuler.net][Project Euler]]. The eval/1 is a slightly
modified version of [[http://www.trapexit.org/String_Eval][this one]] on
TrapExit.
