Pregunta de entrevista de Bayview Asset Management

What's the time complexity of this algorithm you just described