码迷,mamicode.com
首页 >  
搜索关键字:linked_list    ( 3784个结果
LeetCode 92. Reverse Linked List II
Reverse a linked list from position m to n. Do it in one-pass. Note: 1 ≤ m ≤ n ≤ length of list. Example: 根据经验,先建立一个虚结点dummy node,连上原链表的头结点,这样的话就算头结点变 ...
分类:其他好文   时间:2019-03-23 11:47:07    阅读次数:144
82. Remove Duplicates from Sorted List II(js)
82. Remove Duplicates from Sorted List II Given a sorted linked list, delete all nodes that have duplicate numbers, leaving only distinct numbers from ...
分类:Web程序   时间:2019-03-23 00:36:00    阅读次数:166
[Algorithm] Reverse a linked list
It helps to understands how recursive calls works. So for our 'helper' function, when calling it, it stop there until when reach the end. one | two | ...
分类:其他好文   时间:2019-03-22 00:32:06    阅读次数:118
leetcode 206. 反转链表(Reverse Linked List)
[TOC] 题目描述: 反转一个单链表。 示例: 进阶: 你可以迭代或递归地反转链表。你能否用两种方法解决这道题? 解法: cpp / Definition for singly linked list. struct ListNode { int val; ListNode next; ListN ...
分类:其他好文   时间:2019-03-21 10:34:53    阅读次数:142
leetcode 203. 移除链表元素(Remove Linked List Elements)
[TOC] 题目描述: 删除链表中等于给定值 val 的所有节点。 示例: 解法: ...
分类:其他好文   时间:2019-03-20 17:28:46    阅读次数:142
234. Palindrome Linked List(回文链表)
Given a singly linked list, determine if it is a palindrome. Example 1: Example 2: 题目要求:以 O(1) 的空间复杂度来求解。 切成两半,把后半段反转,然后比较两半是否相等。 时间复杂度:o(n) 空间复杂度:o(1 ...
分类:其他好文   时间:2019-03-19 23:27:42    阅读次数:262
141. 环形链表(Linked List Cycle)
[TOC] 题目描述: 给定一个链表,判断链表中是否有环。 为了表示给定链表中的环,我们使用整数 来表示链表尾连接到链表中的位置(索引从 0 开始)。 如果 是 ,则在该链表中没有环。 示例 1: 示例 2: 示例 3: 进阶: + 你能用 O(1)(即,常量)内存解决此问题吗? 解法: ...
分类:其他好文   时间:2019-03-19 18:21:05    阅读次数:166
leetcode 83. 删除排序链表中的重复元素(Remove Duplicates from Sorted List)
[TOC] 题目描述: 给定一个排序链表,删除所有重复的元素,使得每个元素只出现一次。 示例 1: 示例 2: 解法: / Definition for singly linked list. struct ListNode { int val; ListNode next; ListNode(in ...
分类:编程语言   时间:2019-03-19 10:44:11    阅读次数:183
19. Remove Nth Node From End of List(删除链表中的第n个结点)
Given a linked list, remove the n-th node from the end of list and return its head. Example: Note: Given n will always be valid. 方法一:双指针 删除倒数第n个点,我们首先 ...
分类:其他好文   时间:2019-03-18 23:41:20    阅读次数:210
148. Sort List
Sort a linked list in O(n log n) time using constant space complexity. Example 1: Example 2: 这种答案就是让人看着非常的舒适,有一种为什么他妈的这么好的感觉,嗯 ...
分类:其他好文   时间:2019-03-16 12:49:23    阅读次数:124
3784条   上一页 1 ... 42 43 44 45 46 ... 379 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!