Frage im Vorstellungsgespräch bei Optro

I was asked to solve a data structures and algorithms problem and explain the optimized approach, complexity, and implementation details.