![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
leetcode
DevinDujun
这个作者很懒,什么都没留下…
展开
-
Leetcode刷题-merged two sorted list
题目:merged two sorted list描述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.Example:Input: 1->2->...原创 2019-02-01 15:01:55 · 165 阅读 · 0 评论 -
leetcode-rotate-list
rotate-list描述Given a linked list, rotate the list to the right by k places, where k is non-negative.Example 1:Input: 1->2->3->4->5->NULL, k = 2Output: 4->5->1->2->3-&...原创 2019-02-20 14:06:10 · 181 阅读 · 0 评论 -
leetcode-partition-list
partition-list描述Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x.You should preserve the original relative order of the...原创 2019-02-20 13:41:46 · 172 阅读 · 0 评论 -
leetcode-remove duplicates from sorted list
remove duplicates from sorted list描述Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list.Example 1:Input: 1->2->3-...原创 2019-02-19 21:07:57 · 179 阅读 · 0 评论 -
leetcode-swap nodes in pairs
swap nodes in pairs描述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 may be changed.Example:Given 1-&...原创 2019-02-18 22:05:50 · 136 阅读 · 0 评论 -
leetcode-Remove Nth Node From End of List
Remove Nth Node From End of List描述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 removin...原创 2019-02-18 21:27:31 · 128 阅读 · 0 评论 -
leetcode-middle-of-the-linked-list
middle-of-the-linked-list描述Given a non-empty, singly linked list with head node head, return a middle node of linked list.If there are two middle nodes, return the second middle nodeExample 1:I...原创 2019-02-18 20:28:45 · 174 阅读 · 0 评论 -
leetcode-链表-Palindrome Linked List
Palindrome Linked List描述Given a singly linked list, determine if it is a palindrome.Example 1:Input: 1->2Output: falseExample 2:Input: 1->2->2->1Output: true思路1.翻转链表,逐一比较 (占...原创 2019-02-16 23:21:04 · 166 阅读 · 0 评论 -
leetcode-reverse linked list
题目 reverse linked list描述Reverse a singly linked list.Example:Input: 1->2->3->4->5->NULLOutput: 5->4->3->2->1->NULL解法c++ 慢慢原创 2019-02-02 20:21:11 · 161 阅读 · 0 评论 -
leetcode -remove linked list elements
题目 remove linked list elements描述Remove all elements from a linked list of integers that have value val.Example:Input: 1->2->6->3->4->5->6, val = 6Output: 1->2-&am原创 2019-02-01 21:58:49 · 179 阅读 · 0 评论 -
leetcode - intersection oftwo Linked Lists
题目描述Write a program to find the node at which the intersection of two singly linked lists begins.For example, the following two linked lists:begin to intersect at node c1.Example 1:Input: inter...原创 2019-02-01 21:07:07 · 153 阅读 · 0 评论 -
leetcode- Linked List cycle
题目 Linked List cycle描述Given a linked list, determine if it has a cycle in it.To represent a cycle in the given linked list, we use an integer pos which represents the position (0-indexed) in the l...原创 2019-02-01 19:19:17 · 162 阅读 · 0 评论 -
leetcode刷题remove duplicates from sorted list
题目: remove duplicates from sorted list描述Given a sorted linked list, delete all duplicates such that each element appear only once.Example 1:Input: 1->1->2Output: 1->2Example 2:Input:原创 2019-02-01 18:29:26 · 206 阅读 · 0 评论 -
leetcode-reverse-linked-list-ii
reverse-linked-list-ii描述Reverse a linked list from position m to n. Do it in one-pass.Note: 1 ≤ m ≤ n ≤ length of list.Example:Input: 1->2->3->4->5->NULL, m = 2, n = 4Output: 1-...原创 2019-02-20 15:08:19 · 146 阅读 · 0 评论