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
6
u/[deleted] May 08 '15
Overall these problems were fun but I'd rather just do FizzBuzz or something else that's quick during an interview. I feel that an hour is pushing it and I'm sitting comfortable in my home with my favorite tools, not sweating in front of a whiteboard. Use the interview time to engage with the candidate and get a feel for more than just puzzle coding ability. An hour of time is worth money to both of you and I wouldn't want to waste that much time with a heads-down pop quiz.
I did it in a little over an hour but messed up #4 when sorting as strings, as some people here have pointed out. I fixed it using padding with the letter "A" which is later stripped out.
One and two were easy. Three was easy except whoops, integer overflow. Recoded as longs and whoops, long overflow. Fibonacci gets big fast.
My solution to number five is a brute forcer shown here but I'm sure it can be improved upon:
Answers to number five are as follows: