Facebook hacker cup solutions in PHP