Meta interview question

Algorithmic questions, you should find solution with optimal time complexity.