C3 AI interview question

Time complexity of the code