Best Tech Interview Question I've Seen
I'm a curator of tech interview questions. I'm starting to work with our HR group on a tech recruiting strategy, so I've been looking for more questions. I got an email from a recruiter via a New York Java Meetup group (which is free). The email, of course describes the job requirements, but the best part of the email was the following section:
By starting at the top of the triangle and moving to adjacent numbers on the row below, the maximum total from top to bottom is 27. 59 6
4 6 8
0 7 1 5 I.e. 5 + 9 + 6 + 7 = 27. Write a program in a language of your choice to find the maximum total from top to bottom in triangle.txt, a text file containing a triangle with 100 rows. Send your solution and resume to [123456 AT yodle dot com], replacing 123456 with the maximum sum for the triangle.
I had to try to solve the puzzle to see what they did. I tried my first solution, and got my mail bounced back to me... I got immediate feedback from a "unit test." My second solution didn't work either. My third worked... I'm down to 5 lines of Groovy that take about 150 ms.
Yodle had a great job posting. Note: I don't work for Yodle,
so if you want to speak with them, you'll have to figure out their
culture. On the other hand, if you want a similar culture (at least in
part of our HUGE company - SunGard is #380 on the fortune 500), and want to work in a variety of projects, you can always email me.
If you can solve this puzzle (and possibly have some finance
experience), the interview process will probably just a formality
.
I'm going to have to work on something like yodle's for SunGard Consulting. We currently have job postings like this, which can definitely use some fine tuning.
<sales_pitch>If you want to hire some consultants who can solve those kinds of problems, you can email me for that as well.</sales_pitch>
From http://www.jroller.com/Solomon/entry/best_tech_interview_question_i
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)






Comments
Zqudlyba Navis replied on Thu, 2010/04/29 - 2:25am
Don't reinvent the wheel.
Reuse the puzzles used by Google in filtering out dud engineers.
LOL. If one can solve the puzzles used by Google, why wouldn't you apply for Google rather than CompanyX if CompanyX is using the same puzzles used by Google ?
Raveman Ravemanus replied on Thu, 2010/04/29 - 2:50am
I like the idea thay they send you unit test results.
The question is like all puzzle questions - something you will never do at work. However i dont care about this question at all, id give up and not even try to understand it. maybe i just dont like pointless math.
P.S.its a great question for mathematician, but they might not know how to write programs(however they should since we must know advance math)
Chris Treber replied on Thu, 2010/04/29 - 3:05am
1ms in Java on a 3GHz Dual Core machine (15ms with reading the file; 6 lines not counting imports, reading the file).
Thank you for posting the puzzle!
Chris
Endre Varga replied on Thu, 2010/04/29 - 3:32am
Endre Varga replied on Thu, 2010/04/29 - 3:37am
Chad Hahn replied on Thu, 2010/04/29 - 7:23am
Solomon Duskis replied on Thu, 2010/04/29 - 12:30pm
in response to:
Chad Hahn
Solomon Duskis replied on Thu, 2010/04/29 - 12:31pm
in response to:
Raveman Ravemanus
Chad Hahn replied on Thu, 2010/04/29 - 1:04pm
in response to:
Solomon Duskis
Solomon,
Couple of thoughts of mine and then two good really good posts by Norman Richards and Neil McAllister, IMO.
http://codegoop.com/2010/01/the-tech-interview-test/
http://codegoop.com/2010/03/interview-the-process
Besides all of those things, I like to ask interview candidates what programming books they have read recently and ever. Bonus points for having read Clean Code, Coders at Work, Effective Java, Code Complete, and a whole bunch of others. Devs who don't read books throw up lots of red flags.
Bino B. Manjasseril replied on Thu, 2010/04/29 - 3:04pm
Johan Hoogenboezem replied on Fri, 2010/04/30 - 12:30am
Dimitris Andreou replied on Fri, 2010/04/30 - 1:08am
in response to:
Endre Varga
Artur Biesiadowski replied on Fri, 2010/04/30 - 1:16am
Trick is that it is neither MATH puzzle or pointless code. All you comments would make sense, if we were talking about some obscure math equations or 'ooh, I get it' puzzle. Here it is most basic thing from graph theory, difficulty is not in thinking about actual solution, but not messing up data structures to hold the intermediate data when implementing it. And it is real life, at least if you do anything else than CRUD web apps. We had almost exactly same problem (when we had to find minimum or maximum of elements in structured graph-like structure) in efficient way - and I'm talking about thousands of nodes, tens of thousands times per second. First implementation by a guy who didn't care was talking 1-2 seconds per batch of hundred or so... Another attempt by guy who cared was able to process is fast enough to no show in profile...
So no, you don't have to care - but then don't expect to find jobs in really well paid sectors like investment banking... Of course, being able to solve that triangle thingy is not enough by any means - but understanding how it relates to real problems is a good start.
Dimitris Andreou replied on Fri, 2010/04/30 - 1:29am
Endre Varga replied on Fri, 2010/04/30 - 2:17am
in response to:
Artur Biesiadowski
Eric Samson replied on Fri, 2010/04/30 - 5:22am
Solomon Duskis replied on Sun, 2010/05/02 - 12:57pm
in response to:
Eric Samson
Hey Eric,
I don't have your email address... You're more than welcome to send me the answer. While I'm looking resumes, I'm definitely more interested in meeting techies and discussing what makes a good interview question. You can also send an email to the Yodle guys. The Yodle folks will also be more than happy to say hello without a resume. Their recruiter is a great guy; I got to meet him because of this exercise.
-Solomon
Abhishek Chavan replied on Mon, 2010/05/03 - 12:12am
in response to:
Chad Hahn
Chris Treber replied on Wed, 2010/05/05 - 3:28am
in response to:
Chad Hahn
Gilbert Le Blanc replied on Mon, 2010/05/10 - 2:32pm
As long as the problem has something to do with the work to be done, problem solving has its place.
I participated in TopCoder speed coding contests a while back. I found that the problems were designed to differentiate between the top coders. Those of us on the lower tiers were lumped together as "coders that couldn't solve the problems quickly".
You have to be careful that you don’t weed out people that can contribute to your company, just not in a problem solving way.
I think I solved the triangle math puzzle. I coded two different algorithms, and was stuck on the second algorithm for a while because I ran out of memory space. My solution is 250+ lines of Java, but that includes some debugging code. Yes, I over engineered the solution. But I think coding displays and tests when solving an algorithm is important.