ByteDance Interview Question

linked list related problem, relatively easy