摘要:
https://leetcode.com/problems/remove-nth-node-from-end-of-list/description/Given a linked list, remove the nth node from the end of list and return its head.For example, Given linked list: 1->2->3->... 阅读全文
摘要:
https://leetcode.com/problems/delete-node-in-a-linked-list/description/Write a function to delete a node (except the tail) in a singly linked list, given only access to that node.Supposed the linked... 阅读全文
摘要:
https://leetcode.com/problems/merge-two-sorted-lists/description/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 ... 阅读全文
摘要:
https://leetcode.com/problems/linked-list-cycle/description/ time: o(n) space: o(1) Follow up:Can you solve it without using extra space? if you use e 阅读全文
摘要:
recursive: assume Node2 is the head, subproblem return: null<-Node3 <- Node4 then you want to change to ListNode newHead = reverse(head.next) will gen 阅读全文
摘要:
time complexity: offer(), size(), isEmpty(): o(1) for poll and peek: worst case: offer n times, peek/poll only once: o(n) average case: offer n times, 阅读全文