码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
两个链表的第一个公共节点
这道题目我之前做过就不多解释了:https://www.cnblogs.com/cstdio1/p/13072712.html /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNo ...
分类:其他好文   时间:2020-07-16 00:10:32    阅读次数:52
leetcode-86-partition list
思路: 1.创建两个空链表 2.遍历原始链表 3.将大于x的node中的val放入到maxlist,将小于node的放入到minlist中 4.将两个链表拼接在一起 /** * Definition for singly-linked list. * struct ListNode { * int  ...
分类:其他好文   时间:2020-07-14 21:45:26    阅读次数:53
LeetCode206
题目链接 https://leetcode-cn.com/problems/reverse-linked-list/description/ 题目分析 要求:反转一个单向链表 代码模板里的ListNode给了3个构造函数,明显是方便我们构造结点用的(如果要new,最好要delete) 可以迭代实现, ...
分类:其他好文   时间:2020-07-11 17:17:33    阅读次数:55
[LeetCode] 430. Flatten a Multilevel Doubly Linked List
You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a ...
分类:其他好文   时间:2020-07-11 10:04:24    阅读次数:84
0061. Rotate List (M)
Rotate List (M) 题目 Given a linked list, rotate the list to the right by k places, where k is non-negative. Example 1: Input: 1->2->3->4->5->NULL, k = ...
分类:其他好文   时间:2020-07-11 09:40:09    阅读次数:39
0430. Flatten a Multilevel Doubly Linked List (M)
Flatten a Multilevel Doubly Linked List (M) 题目 You are given a doubly linked list which in addition to the next and previous pointers, it could have a ...
分类:其他好文   时间:2020-07-11 09:25:02    阅读次数:50
430. Flatten a Multilevel Doubly Linked List
You are given a doubly linked list which in addition to the next and previous pointers, it could have a child pointer, which may or may not point to a ...
分类:其他好文   时间:2020-07-11 09:24:32    阅读次数:64
83. 删除排序链表中的重复元素
给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。 示例 1: 输入: 1->1->2输出: 1->2示例 2: 输入: 1->1->2->3->3输出: 1->2->3 我写的错误代码: /** * Definition for singly-linked list. * struct ...
分类:编程语言   时间:2020-07-10 09:32:28    阅读次数:111
LeetCode 面试题02.02. 返回倒数第k个节点
思路描述:采用双指针的思想,让head指针先行移动k个位置,然后head,h同步移动,当head指针移动到链表尾,h指针所指即为倒数第k个节点 LeetCode 代码如下: /** * Definition for singly-linked list. * struct ListNode { * ...
分类:其他好文   时间:2020-07-09 19:06:25    阅读次数:53
02-线性结构3 Reversing Linked List (25分)
02-线性结构3 Reversing Linked List (25分) Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. Fo ...
分类:其他好文   时间:2020-07-04 22:36:18    阅读次数:69
3784条   上一页 1 ... 5 6 7 8 9 ... 379 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!