摘要:
题目:Mergeksorted linked lists and return it as one sorted list. Analyze and describe its complexity.代码:oj测试通过Runtime:231 ms 1 # Definition for singly-l... 阅读全文
摘要:
题目:Given a linked list and a valuex, partition it such that all nodes less thanxcome before nodes greater than or equal tox.You should preserve the or... 阅读全文
摘要:
题目:Given a linked list, swap every two adjacent nodes and return its head.For example,Given1->2->3->4, you should return the list as2->1->4->3.Your al... 阅读全文
摘要:
题目:Given 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' values.For e... 阅读全文
摘要:
原题:Given 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 multiple ofkthen lef... 阅读全文
摘要:
题目:Reverse a linked list from positionmton. Do it in-place and in one-pass.For example:Given1->2->3->4->5->NULL,m= 2 andn= 4,return1->4->3->2->5->NULL... 阅读全文
摘要:
题目:Sort a linked list inO(nlogn) time using constant space complexity.代码:oj 测试通过Runtime:372 ms 1 # Definition for singly-linked list. 2 # class ListNo... 阅读全文
摘要:
题目:Sort a linked list using insertion sort.代码:oj测试通过Runtime:860 ms 1 # Definition for singly-linked list. 2 # class ListNode: 3 # def __init__(sel... 阅读全文
摘要:
公司和学校事情比较多,隔了好几天没刷题,今天继续刷起来。题目:Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve i... 阅读全文
摘要:
题目:Given an input string, reverse the string word by word.For example,Given s = "the sky is blue",return "blue is sky the".代码:oj在线测试通过Runtime:172 ms 1... 阅读全文