Solve linked list, top-K, and string reduction | Meta Interview Question