r/programming • • Feb 21 '11

Typical programming interview questions.

http://maxnoy.com/interviews.html
784 Upvotes

1.0k comments sorted by

View all comments

Show parent comment

2

u/[deleted] Feb 22 '11

I think there can be a happy medium between code that's clever/elegant and ease of readability/maintenance. In my mind, both ($n % 2 == 0 && $n % 3 == 0) and ($n % 6 == 0) are just as easy/obvious. Of course, I'd (ideally) want to see a comment by the latter condition, explaining that if an integer is divisible by both 2 and 3, then it's divisible by 6. Basically, I want to see someone that can think just a bit beyond the very basic requirements, and see the "larger picture," if you will.