KLA interview question

Coding qn based on algo and data structures