Solve UTF-8 Validation & Shortest Path | Meta Interview Question