03 2021 档案
摘要:@ RocketMQ (1) MQ message queue 简单来说,消息队列就是基础数据结构课程里“先进先出”的一种数据结构,但是如果要消除单点故障,保证消息传输的可靠性,并且还能应对大流量的冲击,对消息队列的要求就很高了。分布式消息队列可以提供应用解耦、流量消峰、消息分发等功能,已经成为大型
阅读全文
摘要:Get Kth Magic Number 第k 个数 有些数的素因子只有 3,5,7,请设计一个算法找出第 k 个数。注意,不是必须有这些素因子,而是必须不包含其他的素因子。例如,前几个数按顺序应该是 1,3,5,7,9,15,21。 输入: k = 5 输出: 9 思路 计算一个数的因子只有3,5
阅读全文
摘要:Partition List 分隔链表 Description Given the head of a linked list and a value x, partition it such that all nodes less than x come before nodes greater
阅读全文
摘要:Number of Recent Calls 最近的请求次数 Description You have a RecentCounter class which counts the number of recent requests within a certain time frame. Impl
阅读全文
摘要:Copy List with Random Pointer 复制带随机指针的链表 Description A linked list of length n is given such that each node contains an additional random pointer, whi
阅读全文
摘要:Remove Duplicates from Sorted List 2 删除排序链表中的重复元素 Given the head of a sorted linked list, delete all nodes that have duplicate numbers, leaving only d
阅读全文
摘要:Remove Duplicates from Sorted List删除排序链表中的重复元素 Given the head of a sorted linked list, delete all duplicates such that each element appears only once.
阅读全文
摘要:Remove Nth Node From End of List 删除链表的倒数第 N 个结点 Given the head of a linked list, remove the nth node from the end of the list and return its head. 输入:
阅读全文
摘要:Swap Nodes in Pairs 两两交换链表中的节点 Given a linked list, swap every two adjacent nodes and return its head. 给定一个链表,两两交换其中相邻的节点,并返回交换后的链表 输入:head = [1,2,3,4
阅读全文
摘要:Reverse Nodes in k-Group 以K个节点为一组反转链表 Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of
阅读全文
摘要:Rotate List 旋转链表 Given the head of a linked list, rotate the list to the right by k places. Input: head = [1,2,3,4,5], k = 2 Output: [4,5,1,2,3] 向右旋转
阅读全文
摘要:Reverse Linked List II 反转链表 Given the head of a singly linked list and two integers left and right where left <= right, reverse the nodes of the list
阅读全文
摘要:Happy Number 快乐数 Write an algorithm to determine if a number n is happy. 判断一个数是否是快乐数 Input: n = 19 Output: true Explanation: 1^2 + 9^2 = 82 8^2 + 2^2
阅读全文
摘要:Linked List Cycle find cycle begins 环形链表II [返回环的入口节点] 双指针 快慢指针,快指针一次移动2个node,慢指针一次移动1个node, 通过公式推导的结论,当快慢指针在环内相遇到的节点开始继续使用指针依次遍历到环的入口的步数等于从头结点使用指针依次遍历
阅读全文
摘要:Linked List Cycle 环形链表 哈希表 利用哈希特性,在遍历的同时将节点插入hash;如果插入失败代表链表有环。 /** * Definition for singly-linked list. * class ListNode { * int val; * ListNode next
阅读全文
摘要:Netty(1) 官网的介绍,Netty 是一个高性能、异步事件驱动的 NIO 框架,它提供了对 TCP、UDP 和文件传输的支持,作为一个异步 NIO 框架,Netty 的所有 IO 操作都是异步非阻塞的,通过 Future-Listener 机制,用户可以方便的主动获取或者通过通知机制获得 IO
阅读全文