fangwei (59)in #programming • 25 days ago【LeetCode】19. 删除链表的倒数第 N 个结点1 题目描述 19. 删除链表的倒数第 N 个结点 要求给定一个链表,任务是删除链表的倒数第 n 个结点,并且返回链表的头结点。 2 解题思路 本题可以通过双指针的方法来解决。具体来说,可以使用两个指针 slow…fangwei (59)in #programming • 26 days ago【LeetCode】24. 两两交换链表中的节点1 题目描述 24. 两两交换链表中的节点 要求给定一个链表,要求两两交换其中相邻的节点,并返回交换后链表的头节点。需要注意的是,必须在不修改节点内部的值的情况下完成这个任务(即,只能进行节点交换)。 2 解题思路…fangwei (59)in #study • 27 days ago【并发任务调度】01. 线程基础在当今高度并发的应用环境中,线程管理对于构建高效、响应迅速的系统至关重要。Java 语言的线程模型不断演进,从最初的用户线程到现在的内核线程映射,并在 Java 21 中引入了虚拟线程,旨在提升并发处理能力和资源利用率。本文将概述…fangwei (59)in #programming • last month【LeetCode】206. 反转链表1 题目描述 206. 反转链表 要求给定单链表的头节点 head ,任务是反转链表,并返回反转后的链表。 2 解题思路 递归反转 :使用递归方法,每次反转当前节点 cur 的 next…fangwei (59)in #programming • last month【LeetCode】203. 移除链表元素1 题目描述 203. 移除链表元素 要求给定一个链表的头节点 head 和一个整数 val ,任务是删除链表中所有满足 Node.val == val 的节点,并返回新的头节点。 2 解题思路…fangwei (59)in #programming • last month【LeetCode】146. 螺旋遍历二维数组1 题目描述 LCR 146. 螺旋遍历二维数组 给定一个二维数组 array ,任务是返回「螺旋遍历」该数组的结果。螺旋遍历是指从左上角开始,按照 向右、向下、向左、向上的顺序…fangwei (59)in #programming • last month【LeetCode】54. 螺旋矩阵1 题目描述 54. 螺旋矩阵 要求给定一个 m 行 n 列的矩阵 matrix ,请按照顺时针螺旋顺序返回矩阵中的所有元素。 2 解题思路…fangwei (59)in #programming • last month【LeetCode】59. 螺旋矩阵 II1 题目描述 给定一个正整数 n ,生成一个包含从 1 到 n^2 所有元素的 n x n 正方形矩阵 matrix ,并且这些元素按照顺时针方向螺旋排列。 2 解题思路…fangwei (59)in #programming • last month【LeetCode】209. 长度最小的子数组1 题目描述 209. 长度最小的子数组 要求给定一个含有 n 个正整数的数组 nums 和一个正整数 target 。任务是找出该数组中满足其总和大于等于 target 的长度最小的子数组 [numsl…fangwei (59)in #programming • last month【LeetCode】977. 有序数组的平方1 题目描述 977. 有序数组的平方 要求给定一个按非递减顺序排列的整数数组 nums ,返回一个新的数组,其中每个元素都是原数组中对应元素的平方,并且新数组也需要是非递减顺序排列的。 2 解题思路…fangwei (59)in #programming • last month【LeetCode】283. 移动零1 题目描述 283. 移动零 要求给定一个整数数组 nums ,编写一个函数将所有的 0 移动到数组的末尾,同时保持非零元素的相对顺序不变。该操作必须在原地完成,即不能使用额外的数据结构来存储数组。 2 解题思路…fangwei (59)in #programming • 2 months ago【LeetCode】27. 移除元素1 题目描述 27. 移除元素 要求给定一个数组 nums 和一个值 val ,编写一个方法来原地移除数组中所有等于 val 的元素,并返回移除后数组的新长度。不需要保持元素的原始顺序。 2 解题思路…fangwei (59)in #programming • 2 months ago【LeetCode】26. 删除有序数组中的重复项1 题目描述 26. 删除有序数组中的重复项 要求给定一个非严格递增排列的整数数组 nums ,要求原地删除数组中的重复元素,使得每个元素只出现一次,并返回删除重复元素后的数组长度。需要注意的是,元素的相对顺序应保持不变。…fangwei (59)in #study • 2 months ago【MySQL】04. 事务管理(三):MVCC多版本并发控制(MVCC,Multi-Version Concurrency Control)提供了一种不同于传统锁机制的解决方案,通过维护数据的多个版本,依据特殊的版本比对规则,每个事务仅能看到符合其读视图的数据版本,以此实现…fangwei (59)in #programming • 2 months ago【LeetCode】69. x 的平方根1 题目描述 给定一个非负整数 x ,要求计算并返回 x 的算术平方根的整数部分。需要注意的是,不能使用任何内置的指数函数或运算符来求解该问题。 2 解题思路…fangwei (59)in #programming • 2 months ago【LeetCode】34. 在排序数组中查找元素的第一个和最后一个位置1 题目解析 34. 在排序数组中查找元素的第一个和最后一个位置 要求在一个非递减排序的数组中找到特定元素 target 的起始位置和结束位置,并且要求的时间复杂度为O(log n),这提示我们使用二分查找法来解决问题。 2…fangwei (59)in #programming • 2 months ago【LeetCode】35. 搜索插入位置1 题目描述 35. 搜索插入位置 要求根据给定一个排序数组 nums 和一个目标值 target ,在数组中找到目标值,并返回其索引。如果目标值不存在于数组中,则返回它将会被按顺序插入的位置。要求使用的时间复杂度为…fangwei (59)in #programming • 2 months ago【LeetCode】704. 二分查找1 题目描述 704. 二分查找 要求实现一个二分查找算法,来在一个升序排列的整数数组中查找指定的目标值 target 。如果找到目标值,则返回它的索引;如果没有找到,则返回 -1 。 2 解题思路…fangwei (59)in #study • 2 months ago【MySQL】04. 事务管理(二):锁机制在之前的章节中,我们详细探讨了事务的ACID属性以及事务隔离级别的概念,理解了事务如何在并发环境中保持数据的一致性和完整性。本章我们将进一步深入事务管理的核心——锁机制,它是事务隔离级别的基石,也是实现数据库并发控制的关键。 1…fangwei (59)in #study • 2 months ago【MySQL】04. 事务管理(一):ACID与隔离级别在多用户数据库环境中,事务的ACID属性与隔离级别是确保数据一致性和操作安全性的关键。本文通过介绍事务的原子性、一致性、隔离性和持久性,以及常见的并发问题如脏读、不可重复读和幻读,结合MySQL四种隔离级别(读未提交、读已提交、可重复读、串