r/programming • u/svpino • May 08 '15
Five programming problems every Software Engineer should be able to solve in less than 1 hour
https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour
2.5k
Upvotes
1
u/featherfooted May 08 '15
here's my python solution without itertools. Unfortunately, I take no effort to prune my recursion tree and so this is basically a veiled brute-force.
Notes:
"zippy" was my solution to problem #2
In the first line of the evaluate() function, if you don't throw out the first marker character (using the [1::]) then my program discovers the "twelfth" solution that lets a negative sign appear in front of the 1. That is, -1+2-3+4+5+6+78+9 = 100 and it's the only solution using a negative in the first slot. If you throw out the marker with [1::] then the program only discovers the same 11 as everyone else.