Meta interview question

Is there any alternative solution to the coding problem? What about its complexity compared to yours?