project44 interview question

Can you state its time/space complexity?