Domanda di colloquio di Vanguard

Write an algorithm and explain its complexity