http://thisthread.blogspot.com/2013/10/commuting-engineer-codeeval-problem.html