This was a contest on HackerRank.com