Google interview question

Implement a Data Structure Algortihm puzzle