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

11

u/Backfiah May 08 '15

That's 9! runs though.

50

u/anttirt May 08 '15

between the numbers 1, 2, ..., 9 (in this order)

The original problem is only on the order of 38 steps brute-forced.

2

u/AcidDrinker May 08 '15 edited Dec 14 '15

Here's a simple solution in C : {{ LINK REMOVED }}

1

u/scramblor May 08 '15

Good start but I think it has a few problems.

  1. You stop recursion when a solution has been found. I would suspect that there would be more solutions with different permutations in the tree.

  2. It doesn't look like you handle the case of multiple numbers greater than 2 digits.

→ More replies (1)