KLM interview question

assignment with data structure implementation