TypeScript solution for /r/DailyProgrammer#175