r/programming • • 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

2.1k comments sorted by

View all comments

Show parent comments

167

u/droogans May 08 '15

The fourth question is a cleverly disguised string manipulation problem.

Number five is the only one I found myself doubting my ability to solve in an hour.

59

u/timeshifter_ May 08 '15

It'd be piss-easy to solve with brute force JS. Just create every possible valid string combination of those 9 digits with + and -, and eval() them for whichever ones come out to be 100.

11

u/Backfiah May 08 '15

That's 9! runs though.

6

u/sbelljr May 08 '15 edited May 08 '15

9! = 362880

Shouldn't take too long. The point of the question is to get the answer, not to get the answer that works for extremely large cases too.

Edit. There are 38 = 6561 possibilities to check, not 9!. The whole point of the question is to brute force it. My point stands.

→ More replies (9)