
Leetcode
文章平均质量分 75
sdausxc
这个作者很懒,什么都没留下…
展开
-
Leetcode 23. Merge k Sorted Lists
原题:Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.题目大意:对于k个有序的链表,将其合并为一个有序的链表通过归并的方法进行排序:/** * Definition for singly-linked list. * struct原创 2016-07-30 11:30:25 · 317 阅读 · 0 评论 -
Leetcode 24 :Swap Nodes in Pairs
题目大意:给定一个链表,交换其中相邻的2个元素Given a linked list, swap every two adjacent nodes and return its head.For example,Given 1->2->3->4, you should return the list as 2->1->4->3.Your algorithm should u原创 2016-07-31 11:49:17 · 235 阅读 · 0 评论 -
LeetCode 25. Reverse Nodes in k-Group
题意:根据k的大小进行循环移位Given a linked list, reverse the nodes of a linked list k at a time and return its modified list.If the number of nodes is not a multiple of k then left-out nodes in the end sho原创 2016-07-31 23:03:47 · 227 阅读 · 0 评论 -
92. Reverse Linked List II
题目:从m到n进行链表旋转Reverse a linked list from position m to n. Do it in-place and in one-pass.For example:Given 1->2->3->4->5->NULL, m = 2 and n = 4,return 1->4->3->2->5->NULL.Note:Given原创 2016-08-03 10:40:14 · 226 阅读 · 0 评论