Solutuion to Top Coder Arena challenges