摘要:
Reverse Nodes in k-GroupGiven a linked list, reverse the nodes of a linked listkat a time and return its modified list.If the number of nodes is not a... 阅读全文
摘要:
Reorder ListGiven a singly linked listL: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' val... 阅读全文
摘要:
Insertion Sort ListSort a linked list using insertion sort.算法思路:最基本的插入排序,时间复杂度O(n*n),空间复杂度O(1)代码: 1 public class Solution { 2 public ListNode inse... 阅读全文
摘要:
Partition ListGiven a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should pres... 阅读全文
摘要:
Remove Duplicates from Sorted List IIGiven a sorted linked list, delete all nodes that have duplicate numbers, leaving onlydistinctnumbers from the or... 阅读全文
摘要:
Remove Duplicates from Sorted ListGiven a sorted linked list, delete all duplicates such that each element appear onlyonce.For example,Given1->1->2, r... 阅读全文
摘要:
Merge k Sorted ListsMergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.这道题,第一次刷是过了,第二次同样的代码超时了,看来case是在不断... 阅读全文
摘要:
Merge Two Sorted ListsMerge two sorted linked lists and return it as a new list. The new list should be made by splicing together the nodes of the fir... 阅读全文
摘要:
Rotate ListGiven a list, rotate the list to the right bykplaces, wherekis non-negative.For example:Given1->2->3->4->5->NULLandk=2,return4->5->1->2->3-... 阅读全文
摘要:
Swap Nodes in PairsGiven a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2-... 阅读全文