ByteDance interview question

linked list related problem, relatively easy