摘要:
1. 原始题目 Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Example 2: 2. 题目理解 给定一个链表,旋转链表,将链表每个节点向右移动 阅读全文
摘要:
1. 原始题目 Given a linked list, swap every two adjacent nodes and return its head. You may not modify the values in the list's nodes, only nodes itself m 阅读全文
摘要:
1. 原始题目 Given a linked list, remove the n-th node from the end of list and return its head. Example: 2. 题目理解 删除列表中倒数第n个数 注意:空列表,和n大于链表长度的情况 3. 解题 改题和剑 阅读全文
摘要:
1. 原始题目 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their node 阅读全文
摘要:
1. 原始题目 Reverse a singly linked list. Example: 2. 题目理解 反转一个单链表 注意:空链表的处理,单个结点的处理 3. 解法 因为在反向指向结点的时候容易导致链表出现断裂,所以需3个结点保存当前结点,当前结点之前,之后的结点。 4. 验证结果 1 1 阅读全文
摘要:
1. 原始题目 Merge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the first two lists. 阅读全文