摘要:
Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from the original list. //剑指offer删除链表中重复的结点 Fo 阅读全文
posted @ 2019-04-09 16:19
MarkLeeBYR
阅读(84)
评论(0)
推荐(0)
摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal tox. You should preserve the o 阅读全文
posted @ 2019-04-09 16:19
MarkLeeBYR
阅读(98)
评论(0)
推荐(0)
摘要:
Sort a linked list in O(n log n) time using constant space complexity. //利用归并排序的思想 class Solution { public ListNode sortList(ListNode head) { if (head 阅读全文
posted @ 2019-04-09 16:17
MarkLeeBYR
阅读(106)
评论(0)
推荐(0)
摘要:
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文
posted @ 2019-04-09 16:15
MarkLeeBYR
阅读(88)
评论(0)
推荐(0)
摘要:
Sort a linked list using insertion sort. public class Solution { public ListNode insertionSortList(ListNode head) { ListNode root = new ListNode(0); / 阅读全文
posted @ 2019-04-09 16:15
MarkLeeBYR
阅读(87)
评论(0)
推荐(0)
摘要:
Given a linked list, return the node where the cycle begins. If there is no cycle, return null. Note: Do not modify the linked list. Follow up:Can you 阅读全文
posted @ 2019-04-09 16:14
MarkLeeBYR
阅读(90)
评论(0)
推荐(0)