KLM Interview Question

Data structures implementation, mathematical thinking