Youdao.com interview question

Just regular algorithm questions.