NYCPHP Meetup

NYPHP.org

[nycphp-talk] Questions to ask at a job interview?

Urb LeJeune urb at e-government.com
Sat Jul 7 23:25:58 EDT 2007


I've been following this thread with interest. To a certain point I think
you're going about this in the wrong way. Programming is about
problem solving, it's about syntax, that's the easy part. I good
problem solver can use a book to lean the syntax to code a solved
problem. Someone who aces a programming test because they
have memorized a manual is non necessarily a good problem
solver.

Try this on a candidate.

Write an algorithm (not language specific code) to do the following:

Players is a variable holding the number of players in a single
elimination tournament. If you loose a match, you're out. The
winner is determined when there is no one left to play.

Output the value of Matches which is a variable containing the
number of matches required in the tournament.

On problem that is non-trivial will have multiple solutions, we
want the most efficient.

Resist the temptation to express the algorithm in PHP or any
other programming language.

The algorithm is like:

1. Input Players as the number of players in a single elimination tournament.
...
...
X. Output Matches which is the number of matches required in a single
elimination tournament containing N (Players) players

Hire any candidates who come up with an elegant solution. Then teach
them any syntactic structures they don't know.

BTW, I personally think swapping the contents of two variables without a
temporary variables proves nothing. It's a trick we learned if we studied
assembly language. Tricks do not a good programmer make. When is
the last time you used an XOR is a real program?

Urb

Dr. Urban A. LeJeune, President
E-Government.com
800-204-9545





More information about the talk mailing list