Fora Interview Question

Time complexity of solution provided