leetcode--reverse-nodes-in-k-group--链表

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 the...

2018-03-03 13:03:44

阅读数:17

评论数:0

leetcode---insertion-sort-list---链表

Sort a linked list using insertion sort. /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ...

2018-01-21 21:31:53

阅读数:53

评论数:0

leetcode---median-of-two-sorted-arrays---链表

There are two sorted arrays A and B of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity should be...

2017-11-01 19:37:04

阅读数:101

评论数:0

leetcode---add-two-numbers---链表

You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single...

2017-10-31 18:44:59

阅读数:103

评论数:0

leetcode---swap-nodes-in-pairs---链表

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...

2017-10-30 20:11:49

阅读数:93

评论数:0

leetcode---reverse-linked-list-ii---链表

Reverse a linked list from position m to n. Do it in-place and in one-pass. For example: Given1->2->3->4->5->NULL, m = 2 and n = 4, ...

2017-10-29 17:13:06

阅读数:106

评论数:0

链表---在有序链表中寻找中点的两种方式

当链表中的节点数为偶数,代码1找到的中点偏前,代码2找的中点偏后 如:1, 2, 3, 4 代码1找到的中点为2,代码2找到的中点为3代码1 ListNode *findMid(ListNode *head) { ListNode *fast = head; ...

2017-10-29 16:08:46

阅读数:233

评论数:0

leetcode---copy-list-with-random-pointer---链表

A linked list is given such that each node contains an additional random pointer which could point to any node in the list or null. Return a deep co...

2017-10-29 13:57:49

阅读数:167

评论数:0

leetcode---merge-k-sorted-lists---链表

Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity./** * Definition for singly-linked list. * struct...

2017-10-25 19:13:02

阅读数:85

评论数:0

leetcode---rotate-list---链表

Given a list, rotate the list to the right by k places, where k is non-negative. For example: Given1->2->3->4->5->NULLand k =2, ret...

2017-10-25 18:47:26

阅读数:90

评论数:0

leetcode---remove-duplicates-from-sorted-list---链表

Given a sorted linked list, delete all duplicates such that each element appear only once. For example, Given1->1->2, return1->2. Given1-...

2017-10-24 19:11:49

阅读数:114

评论数:0

leetcode---partition-list---链表

Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve th...

2017-10-24 18:30:21

阅读数:121

评论数:0

leetcode---merge-two-sorted-lists---链表

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 lists./** * D...

2017-10-21 18:04:27

阅读数:84

评论数:0

leetcode---linked-list-cycle-ii---链表

Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull. Follow up: Can you solve it without using extra spac...

2017-10-20 18:37:43

阅读数:64

评论数:0

leetcode---linked-list-cycle---链表中点

Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space?/** * Definition for singly-linked l...

2017-10-19 21:26:54

阅读数:128

评论数:0

leetcode---reorder-list---链表中点、逆转

Given a singly linked list L: L 0→L 1→…→L n-1→L n, reorder it to: L 0→L n →L 1→L n-1→L 2→L n-2→… You must do this in-place without altering the nod...

2017-10-18 19:49:16

阅读数:119

评论数:0

leetcode---remove-nth-node-from-end-of-list---链表

Given a linked list, remove the n th node from the end of list and return its head. For example, Given linked list: 1->2->3->4->5, a...

2017-10-16 14:50:24

阅读数:87

评论数:0

leetcode---Odd Even Linked List

Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not th...

2017-04-05 20:35:35

阅读数:461

评论数:0

leetcode---Reverse Linked List---链表

Reverse a singly linked list. /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(i...

2016-11-16 13:53:18

阅读数:181

评论数:0

leetcode---Remove Linked List Elements

Remove all elements from a linked list of integers that have value val. Example Given: 1 --> 2 --> 6 --> 3 --> 4 --> 5 --> 6, val =...

2016-11-14 17:30:59

阅读数:140

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭