The idea is that *you* are supposed to write the code. The test is testing your programming skills, not mine.
Post what you've got so far and explain in detail where you're stuck, and we'll try to unstick you, but we won't do your homework for you.