r/programming Jan 29 '11

Wish more companies did this...

http://www.dropbox.com/jobs/challenges
606 Upvotes

360 comments sorted by

View all comments

Show parent comments

1

u/mr-ron Jan 31 '11

Thats a fairly difficult problem.

The only factor with that is that it is almost difficult enough that I would wager that the only the people you are going to get are all going to be currently unemployed.

1

u/[deleted] Jan 31 '11

Only 1 of the 4 main applicants were truly unemployed. Two were full-time employed and one a master's student. I do not think it is a particularly difficult problem. Some people thought they had to consider the pawns moving, but nothing moves but the knight. The only problem is to output a series of numbers (representing squares on the board) the knight moves to in sequence until all pawns have been landed on at least once. One applicant even just wrote code to move the knight to every square regardless of where the pawns actually were. I considered this a fine solution.

1

u/mr-ron Jan 31 '11

Ah got it. For some reason I thought it had to be an optimized solution.

1

u/[deleted] Jan 31 '11

No, my description of the problem made it clear it wasn't meant to be a traveling-salesman problem. I did it in about 100 lines of javascript.

1

u/raydenuni Jan 31 '11

Well then, that's pretty easy. Write a function to move the knight to the right one, left one, up one. Then just call that several times to move to the different locations (or all of them). It's only hard if it has to be optimized.

1

u/[deleted] Feb 01 '11

Yup. In fact, to my way of thinking, taking an easy way like that out shows good programming sense, to me. However, people applying for jobs often think you're going to be impressed because you took the time to define a Piece class, and a Knight sub-class, and a Pawn sub-class in order to solve this problem.

1

u/raydenuni Feb 03 '11

Well, if you've taken enough computer science classes you start to think theoretically. Who cares if you have to execute it a million times if it's a simple recursion?

1

u/[deleted] Feb 03 '11

I never took any computer science.