Meta interview question

Solve a coding question with relatively high efficiency.