That's nice, but guess it is better to allow the OP to try it first, post his/her code/efforts, then show or provide hints, pseudo code, semi solutions, that way he/she/all can learn, not just to simply providing an out of box solution and do his/her homework, have seen these type of posting lately here, instead why not post those on the 'show your stuff', that way at least they can look good.
Maybe it is me, but take it as there it is just two cents.