Amazon interview question

Time complexity of technical solution