Implement string dedup and mirror tree traversal | Meta Interview Question