Everpure interview question

Basic data structure and algorithm.