Domanda di colloquio di bp

Algorithm question with complexity analysis