ByteDance interview question

A easy-hard level coding question