LeetCode题集-链表

2018-04-09  本文已影响5人  01_小小鱼_01

链表逆序

206. Reverse Linked List

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) { val = x; }
 * }
 */
class Solution {
    public ListNode reverseList(ListNode head) {
        
    }
}

92. Reverse Linked List II

Reverse a linked list from position m to n. Do it in-place and in one-pass.
For example:
Given 1->2->3->4->5->NULL, m = 2 and n = 4,
return 1->4->3->2->5->NULL.
Note:
Given m, n satisfy the following condition:
1 ≤ m ≤ n ≤ length of list.

/**
 * Definition for singly-linked list.
 * public class ListNode {
 *     int val;
 *     ListNode next;
 *     ListNode(int x) { val = x; }
 * }
 */
class Solution {
    public ListNode reverseBetween(ListNode head, int m, int n) {
        
    }
}

求两个链表的交点

链表的节点交换(LeetCode 24. Swap Nodes in Pairs)

链表求环(LeetCode 141,142. Linked List Cycle 1,2)

链表重新构造(LeetCode 86. Partition List)

复杂的链表复制(LeetCode 138. Copy List with Random Pointer)

排序链表合并(2个与多个) (LeetCode 21,23 Merge Two(k) Sorted ListsLeetCode)

上一篇 下一篇

猜你喜欢

热点阅读