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

1

u/goomyman May 08 '15

i really like this solution honestly, props.

3

u/isarl May 08 '15

It's a bad solution. Brute force is more effective for #5. For 4, a greedy approach will work – always take the next number with the highest leading digit. If you have two numbers starting with, e.g., 9, then recurse on each and take the max.