Topcoder Exercise