But I think making people code for free is somewhat unethical unless it's for open source. As an applicant I would feel that I was being taken advantage of if you used my code, didn't open source it, and didn't give me the job.
I'm not a lawyer, so I could be totally wrong on this one - but I'd be a little worried that this could become grounds for a lawsuit. Perhaps not a serious one, but, for example, a lawsuit to obstruct an eventual IPO or investment.