Google interview question

Data structures and a Discrete math problem.