Solving the Facebook Hacker Cup 2017 Qualification Round, Problem 3 | Hacker News Reader