CareerCup 150 question. Implement in Java/C++/C#