Google interview question

Basic traversal and data structure problems