![](https://img-blog.csdnimg.cn/20201014180756724.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Leetcode
清欢_
革命尚未成功 少年仍需努力
展开
-
[LeetCode_19] Remove Nth Node From End of List_删除链表的倒数第N个节点
leetcode_19题目描述:Given a linked list, remove the n-th node from the end of list and return its head.Example:Given linked list: 1->2->3->4->5, and n = 2.After removing the second nod...原创 2018-11-13 14:46:24 · 161 阅读 · 0 评论 -
[LeetCode_24] Swap Nodes in Pairs_两两交换链表中的节点
leetcode_24题目描述Given a linked list, swap every two adjacent nodes and return its head.Example:Given 1->2->3->4, you should return the list as 2->1->4->3.Note:Your algorithm...原创 2018-11-13 15:34:04 · 138 阅读 · 0 评论 -
[LeetCode_83] Remove Duplicates from Sorted List_删除排序链表中的重复元素
leetcode_83### 题目描述Given a sorted linked list, delete all duplicates such that each element appear only once.Example 1:Input: 1->1->2 Output: 1->2 Example 2:Input: 1->1->2->3原创 2018-11-13 17:57:41 · 125 阅读 · 0 评论 -
[LeetCode_141] Linked List Cycle_环形链表
leetcode_141题目描述Given a linked list, determine if it has a cycle in it.Follow up: Can you solve it without using extra space?思路:设置两个指针p,q,从头结点开始,p节点每次走一步,q节点每次走两步,如果两个指针会相遇,则为环形链表,如果较快的指针q到达了...原创 2018-11-14 17:16:24 · 136 阅读 · 0 评论