双向 实战leetcode lru

[LeetCode Hot 100] LeetCode86. 分隔链表

题目描述 思路 可以将链表分成两个小链表,一个链表中的元素大小都小于x,另一个链表中的元素都大于等于x,然后再把这两条链表连接到一起,就得到题目想要的结果。 这个题类似于合并两个有序链表:只不过另一个链表只有唯一一个节点x。 合并这两个链表。 方法一: /** * Definition for si ......
LeetCode Hot 100 86

[LeetCode Hot 100] LeetCode23. 合并K个升序链表

题目描述 思路:优先队列 使用优先队列这个数据结构,对于这个数据结构,我们不用去管内部是如何实现的,我们只要知道有这么一种数据结构能帮助我们将一堆数据塞到优先队列这一个黑盒中,然后我们可以获取这堆数中最小的值或者最大的值。 代码一: /** * Definition for singly-linke ......
LeetCode 升序 Hot 100 23

单元测试实战(二)Service 的测试

单元测试实战(二)Service 的测试 为鼓励单元测试,特分门别类示例各种组件的测试代码并进行解说,供开发人员参考。 本文中的测试均基于JUnit5。 单元测试实战(一)Controller 的测试 单元测试实战(二)Service 的测试 单元测试实战(三)JPA 的测试 单元测试实战(四)My ......
实战 单元 Service

leetcode中SQL学习

https://leetcode.cn/studyplan/sql-free-50/ 查询 可回收且低脂的产品 表:Products + + + | Column Name | Type | + + + | product_id | int | | low_fats | enum | | recyc ......
leetcode SQL

[LeetCode] 1716. Calculate Money in Leetcode Bank

Hercy wants to save money for his first car. He puts money in the Leetcode bank every day. He starts by putting in $1 on Monday, the first day. Every ......
Calculate LeetCode Leetcode Money 1716

七天.NET 8操作SQLite入门到实战 - 第六天后端班级管理相关接口完善和Swagger自定义配置

前言 在上一章节我们在后端框架中引入 SQLite-net ORM 并封装常用方法(SQLiteHelper),今天我们的任务是设计好班级管理相关的表、完善后端班级管理相关接口并对Swagger自定义配置。 七天.NET 8 操作 SQLite 入门到实战详细教程 第一天 SQLite 简介 第二天 ......
天后 实战 班级 接口 Swagger

耗时三年开源的H5商城,生产级代码实战

waynboot-mall 商城项目是我从疫情开始初期着手准备开发的,到如今 2023 年底,已经过了 3 年多的时间。 从项目初期到现在,一个人持续迭代,修复漏洞,添加功能,经历了前端开发工具从 vue2、vue-cli 切换到 vue3、vite 的转变,也经历了后端技术框架从 Spring B ......
实战 代码 商城

Nodejs APM监控实战分享

如何对线上的 nodejs 做监控,了解相关的 GC、内存使用情况、性能,如何更好的了解相关的指标,我们需要做一个采集线上数据的方案,但是又不希望侵入性太强 ,首先收集的指标。 内存相关指标说明 堆内存 rss:常驻内存,node 进程分配的总内存大小 external:v8 管理的 C++所占用的 ......
实战 Nodejs APM

Leetcode刷题day7-字符串.反转ⅠⅡ.反转单词.右旋转

344.反转字符串 344. 反转字符串 - 力扣(LeetCode) 编写一个函数,其作用是将输入的字符串反转过来。输入字符串以字符数组 s 的形式给出。 不要给另外的数组分配额外的空间,你必须原地修改输入数组、使用 O(1) 的额外空间解决这一问题。 示例 1: 输入:s = ["h","e", ......
字符串 单词 字符 Leetcode day7

[LeetCode] 498. Diagonal Traverse 对角线遍历

题目 Given an m x n matrix mat, return an array of all the elements of the array in a diagonal order. 思考 最初在纸上写写画画试了很多想法,但都没能解决,真的。。太弱了T T。 后来在YT上看了个印度老 ......
对角线 对角 LeetCode Diagonal Traverse

[LeetCode Hot 100] LeetCode73. 矩阵置零

题目描述 思路一:开辟两个数组,时间复杂度O(m + n) 开辟两个数组用来记录哪些行、哪些列需要置为零。 这样时间复杂度为O(m + n)。 思路二: 原地算法:不适用额外空间或者说常数级空间来实现算法。 类似于使用set保存每行每列是否需要置零, 方法一:对应思路一 class Solution ......
LeetCode 矩阵 Hot 100 73

KubeKey 升级 KubeSphere 和 Kubernetes 补丁版本实战指南

作者:运维有术 前言 知识点 定级:入门级 KubeKey 如何升级 KubeSphere 补丁版本 KubeKey 如何升级 Kubernetes 补丁版本 KubeSphere 和 Kubernetes 升级准备及验证 KubeKey 升级 KubeSphere 和 Kubernetes 的常见 ......
KubeSphere Kubernetes 实战 补丁 KubeKey

机器学习-逻辑回归:从技术原理到案例实战

在本篇文章中,我们对逻辑回归这一经典的机器学习算法进行了全面而深入的探讨。从基础概念、数学原理,到使用Python和PyTorch进行的实战应用,本文旨在从多个角度展示逻辑回归的内在机制和实用性。 关注TechLead,分享AI全维度知识。作者拥有10+年互联网服务架构、AI产品研发经验、团队管理经 ......
实战 逻辑 原理 机器 技术

小程序开发实战案例之二|如何实现小程序支付

上一章讲完如何获取用户信息授权 后,下一步就可以进行小程序支付了。 本期就来介绍下支付宝小程序支付如何实现。 PS:接入前的准备工作可以参考:接入准备;接入指南可参考:接入指南~ 获取小程序支付权限 获取权限分为三步:分别是 账号开通 JSAPI 支付、账号与小程序账号绑定 以及 小程序绑定 JSA ......
实战 案例 程序

leetcode-1662-easy

Check If Two String Arrays are Equivalent 思路一:把第一个数组入队列,然后遍历比较第二个数组 public boolean arrayStringsAreEqual(String[] word1, String[] word2) { Deque<Charac ......
leetcode 1662 easy

leetcode-1732-easy

Find the Highest Altitude 思路一:直接遍历 public int largestAltitude(int[] gain) { int val = 0; int max = val; for (int i : gain) { val += i; max = Math.max( ......
leetcode 1732 easy

leetcode-1646-easy

Get Maximum in Generated Array You are given an integer n. A 0-indexed integer array nums of length n + 1 is generated in the following way: nums[0] = ......
leetcode 1646 easy

leetcode-2169-easy

Count Operations to Obtain Zero You are given two non-negative integers num1 and num2. In one operation, if num1 >= num2, you must subtract num2 from ......
leetcode 2169 easy

leetcode-2180-easy

Count Integers With Even Digit Sum Given a positive integer num, return the number of positive integers less than or equal to num whose digit sums are ......
leetcode 2180 easy

leetcode-1455-easy

Check If a Word Occurs As a Prefix of Any Word in a Sentence Given a sentence that consists of some words separated by a single space, and a searchWor ......
leetcode 1455 easy

leetcode-1464-easy

Maximum Product of Two Elements in an Array Given the array of integers nums, you will choose two different indices i and j of that array. Return the ......
leetcode 1464 easy

leetcode-1512-easy

Number of Good Pairs Given an array of integers nums, return the number of good pairs. A pair (i, j) is called good if nums[i] == nums[j] and i < j. E ......
leetcode 1512 easy

leetcode-1550-easy

Three Consecutive Odds Given an integer array arr, return true if there are three consecutive odd numbers in the array. Otherwise, return false. Examp ......
leetcode 1550 easy

leetcode-1572-easy

Matrix Diagonal Sum Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagona ......
leetcode 1572 easy

[LeetCode] 1688. Count of Matches in Tournament

You are given an integer n, the number of teams in a tournament that has strange rules: If the current number of teams is even, each team gets paired ......
Tournament LeetCode Matches Count 1688

Leetcode 80. 删除有序数组中的重复项 II

被前面类似的题禁锢了思路,自己写的双指针,感觉题解很巧妙,记录一下。这个解法不用记录cnt。 通用解法 为了让解法更具有一般性,我们将原问题的「保留 2 位」修改为「保留 k 位」。 对于此类问题,我们应该进行如下考虑: 由于是保留 k 个相同数字,对于前 k 个数字,我们可以直接保留 对于后面的任 ......
数组 Leetcode 80 II

Leetcode刷题day6-哈希表.双指针.三~四数求和.

454.四数相加Ⅱ 454. 四数相加 II - 力扣(LeetCode) 给你四个整数数组 nums1、nums2、nums3 和 nums4 ,数组长度都是 n ,请你计算有多少个元组 (i, j, k, l) 能满足: 0 <= i, j, k, l < n nums1[i] + nums2[ ......
指针 Leetcode day6 day

[LeetCode Hot 100] LeetCode19. 删除链表的倒数第N个结点

题目描述 思路一:采用两次遍历 第一遍遍历先获取链表的长度length 第二次从dummy节点开始走length - n步 然后将该节点指向下下个节点 思路二:采用一次遍历 设置虚拟节点dummyHead指向head 设定双指针p和q,初始都指向虚拟节点dummyHead 移动q,直到p与q之间相隔 ......
LeetCode 结点 Hot 100 19

[LeetCode Hot 100] LeetCode21. 合并两个有序链表

题目描述 思路:新建dummy去"穿针引线" 新建一个dummy节点去"穿针引线" 注意最后返回的是dummy.next 方法一: /** * Definition for singly-linked list. * public class ListNode { * int val; * List ......
LeetCode 两个 Hot 100 21

Systemd 入门教程:实战篇

一、开机启动 对于那些支持 Systemd 的软件,安装的时候,会自动在/usr/lib/systemd/system目录添加一个配置文件。 如果你想让该软件开机启动,就执行下面的命令(以httpd.service为例)。 $ sudo systemctl enable httpd 上面的命令相当于 ......
入门教程 实战 Systemd 教程