DataVisor interview question

Typical algorithm and data structure questions. A little bit hard.