Fora interview question

Time complexity of solution provided