Domanda di colloquio di Confidential

Explain the time complexity of your solution.