随笔分类 -  List

有序列表、无序列表
[Leetcode 138]复制带随机指针的数列Copy List with Random Pointer
摘要:题目 深复制一个list* Node的结构包含next和random(随机指向节点) 区别 深复制 deep copy Node a=New Node(1) Node b=new Node(1) 复制值 浅复制 shallow copy Node a=new Node(1); Node b=a; 复 阅读全文
posted @ 2021-11-26 21:32 alau 阅读(44) 评论(0) 推荐(0)
[Leetcode 19]删除链表中倒数第N个元素Remove Nth Node From End of List
摘要:题目 删除链表head中倒数第N个元素 Given the head of a linked list, remove the nth node from the end of the list and return its head. Example 1: Input: head = [1,2,3 阅读全文
posted @ 2021-11-23 01:13 alau 阅读(34) 评论(0) 推荐(0)
[Leetcode 445]正序链表相加Add Two Numbers II
摘要:【题目】 将链表组成的数相加 leetcode2变式,2题是高位在后,现在是高位在前节点 You are given two non-empty linked lists representing two non-negative integers. The most significant dig 阅读全文
posted @ 2021-08-31 17:11 alau 阅读(79) 评论(0) 推荐(0)
[Leetcode 206]反转链表Reverse Linked List
摘要:【题目】 反转链表是之后很多题的基础 把链表12345反转成54321 Given the head of a singly linked list, reverse the list, and return the reversed list. Example 1: Input: head = [ 阅读全文
posted @ 2021-08-31 16:51 alau 阅读(31) 评论(0) 推荐(0)
[Leetcode 2]两数相加链表Add Two Numbers
摘要:【题目】 将两个用list存储的数字相加,返回相加后的值 You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, 阅读全文
posted @ 2021-08-31 14:31 alau 阅读(37) 评论(0) 推荐(0)
[Leetcode 44]合并有序列表Merge k Sorted Lists
摘要:【题目】 将两个有序链表合并成一个有序链表 Merge two sorted linked lists and return it as a sorted list. The list should be made by splicing together the nodes of the firs 阅读全文
posted @ 2021-08-30 20:40 alau 阅读(40) 评论(0) 推荐(0)
[Leetcode 23]合并有序列表Merge k Sorted Lists
摘要:太久没刷题自闭了爬上来记录下 【题目】 将K个顺序排列的列表合并,输出合并后的列表 Example 1: Input: lists = [[1,4,5],[1,3,4],[2,6]] Output: [1,1,2,3,4,4,5,6] Explanation: The linked-lists ar 阅读全文
posted @ 2021-02-19 22:31 alau 阅读(92) 评论(0) 推荐(0)