Vanguard interview question

Write an algorithm and explain its complexity