热门面试题与答案和在线测试
面向面试准备、在线测试、教程与实战练习的学习平台

通过聚焦学习路径、模拟测试和面试实战内容持续提升技能。

WithoutBook 将分主题面试题、在线练习测试、教程和对比指南整合到一个响应式学习空间中。

面试准备

模拟考试

设为首页

收藏此页面

订阅邮箱地址

Linked List 面试题与答案

问题 1. Write a function to find the middle element of a linked list.

Use two pointers; one moves one step at a time, and the other moves two steps at a time.

Example:

Input: 1 -> 2 -> 3 -> 4 -> 5
Output: 3

这有帮助吗? 添加评论 查看评论
 

问题 2. Check if a linked list is a palindrome.

Reverse the second half of the list and compare it with the first half.

Example:

Input: 1 -> 2 -> 3 -> 2 -> 1
Output: True

这有帮助吗? 添加评论 查看评论
 

问题 3. Swap nodes in pairs in a linked list.

Iterate through the list and swap each pair of adjacent nodes.

Example:

Input: 1 -> 2 -> 3 -> 4
Output: 2 -> 1 -> 4 -> 3

这有帮助吗? 添加评论 查看评论
 

问题 4. Rotate a linked list by k places.

Find the length of the list, then move (length - k % length) steps to the right.

Example:

Input: 1 -> 2 -> 3 -> 4 -> 5, k = 2
Output: 4 -> 5 -> 1 -> 2 -> 3

这有帮助吗? 添加评论 查看评论
 

问题 5. Implement a function to add two numbers represented by linked lists.

Traverse both lists simultaneously, perform addition, and handle carry.

Example:

Input: (7 -> 2 -> 4) + (5 -> 6 -> 4)
Output: 2 -> 9 -> 8

这有帮助吗? 添加评论 查看评论
 

用户评价最有帮助的内容:

版权所有 © 2026,WithoutBook。