拓扑 前缀 线性leetcode

[LeetCode] 2240. Number of Ways to Buy Pens and Pencils

You are given an integer total indicating the amount of money you have. You are also given two integers cost1 and cost2 indicating the price of a pen ......
LeetCode Pencils Number 2240 Ways

动态规划-线性DP

## 动态规划-线性DP ### 1. 线性DP的定义 ``` 所谓线性DP,实际上就是:这类问题的状态转移方程满足一定的线性关系。即,状态递推的顺序是线性的,我们把这类DP问题称为线性DP问题。 ``` ### 2. 线性DP例题:数字三角形 ``` https://www.acwing.com/ ......
线性 动态

拓扑排序

## 拓扑排序 ### 1. 拓扑排序的定义 ![img](https://img2023.cnblogs.com/blog/2206600/202308/2206600-20230804091330351-1946578.png) ![img](https://img2023.cnblogs.co ......
拓扑

前缀和及模板

## 前缀和及模板 ### 1. 一维前缀和数组定义及问题引出 ``` 假设我们拥有原数组:A = a1,a2,a3,...,an 那么,前缀和数组可以定义为:Si = a1+a2+...+ai(即:原数组中前i个数相加所构成的数组) 根据上述的定义,我们可以引出如下问题: 1. 如何求Si? 2. ......
前缀 模板

高维前缀和详解

## 高维前缀和详解 [toc] ### 背景: sensei:我们随便上点技巧类型的东西吧,就这个高位前缀和......(讲了一堆k维前缀和复杂度证明后)......好我们看看版题。 版题: 现在有n(n≤20)个物品,确定每个物品的选取与否可以表示一个集合,那么这n个物品最多可以表示个2的n次方 ......
高维 前缀

快速排序 // 归并排序 模板(复习)高精度乘法/除法模板(高+低)前缀和(一维+二维)差分(一维+二维)模板(8/31)

//快速排序模板 #include<iostream> using namespace std; const int N = 100001; int a[N]; void quickersort(int l,int r) { if(l>=r) return; int i=l-1;int j=r+1; ......
模板 高精 除法 前缀 乘法

高维前缀和(SOSDP)

## 模板 ### 求高维矩阵的前缀和 每个位置上存的是原来单点的值。 #### 一维 点击查看代码 ```cpp for (int i = 1; i #### 二维 1. 容斥 点击查看代码 ```cpp for (int i = 1; i 2. 分解法 分解成多遍一维前缀和 点击查看代码 ``` ......
高维 前缀 SOSDP

LED电动车摩托车灯DC-DC降压恒流芯片AP5170支持线性调光95%高效率IC

AP5170 是一款效率高,稳定可靠的 LED 灯恒流驱动控制芯片,内置高精度比较器,固定关断时间控制电路,恒流驱动电路等,特别适合大功率 LED 恒流驱动。 AP5170 采用 ESOP8 封装,散热片内置接 SW 脚,通过调节外置电流检测的电阻值来设置流过 LED 灯的电流,支持外加电压线性调光... ......
车灯 高效率 线性 电动车 芯片

前缀和(本质:空间换时间)

## 1. 数组种的双指针 借助一个变量做到了降维的优化 ### 1.1 左右指针 ![](https://img2023.cnblogs.com/blog/2171496/202308/2171496-20230831102039191-1781754601.png) ```java class ......
前缀 本质 时间 空间

Leetcode 24. 两两交换链表中的节点(Swap nodes in pairs)

[题目链接](https://leetcode.cn/problems/swap-nodes-in-pairsn/) 给你一个链表,两两交换其中相邻的节点,并返回交换后链表的头节点。你必须在不修改节点内部的值的情况下完成本题(即,只能进行节点交换)。 示例 1: ![](https://img202 ......
节点 Leetcode nodes pairs Swap

[LeetCode][338]counting-bits

# Content Given an integer n, return an array ans of length n + 1 such that for each i (0 <= i <= n), ans[i] is the number of 1's in the binary repres ......
counting-bits LeetCode counting bits 338

医学案例|线性回归

一、案例介绍 某医师预研究糖尿病患者的总胆固醇和甘油三酯对空腹血糖的影响,某研究者调查40名糖尿病患者的总胆固醇、甘油三酯和空腹血糖的测量值如下,试根据上述研究问题作统计分析。 二、问题分析 本案例想要研究一些变量(总胆固醇和甘油三酯)对另一变量(空腹血糖)的影响,可以使用多元线性回归分析进行研究。 ......
线性 案例 医学

[LeetCode][337]house-robber-iii

# Content The thief has found himself a new place for his thievery again. There is only one entrance to this area, called root. Besides the root, each ......
house-robber-iii LeetCode robber house 337

[LeetCode][322]coin-change

# Content You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of mone ......
coin-change LeetCode change coin 322

前缀函数与 KMP 算法

文本串 $t$,模式串 $s$,$m=|t|,n=|s|$。($|s|$ 表示 $s$ 的长度。) $s[i\dots j]$ 表示 $s$ 从 $i$ 到 $j$ 的子串。 默认字符串下标从 $0$ 开始。 ## 引言 有时我们希望在文本串 $t$ 中查找模式串 $s$。比如你按下 Ctrl+F ......
前缀 算法 函数 KMP

[LeetCode][312]burst-balloons

# Content You are given n balloons, indexed from 0 to n - 1. Each balloon is painted with a number on it represented by an array nums. You are asked t ......
burst-balloons LeetCode balloons burst 312

[LeetCode] 2483. Minimum Penalty for a Shop

You are given the customer visit log of a shop represented by a 0-indexed string customers consisting only of characters 'N' and 'Y': if the ith chara ......
LeetCode Minimum Penalty 2483 Shop

leetcode & c++多线程刷题日志

## 1.按序打印 [按序打印](https://leetcode.cn/problems/print-in-order/description/) **解法** + 1. 互斥锁 ```c++ class Foo { mutex mtx1, mtx2; public: Foo() { mtx1.l ......
线程 leetcode 日志 amp

《线性代数》5. 线性系统

### 什么是线性系统 **系统这个概念有点抽象,之前学的矩阵就可以看作是一个系统,线性系统和初中学的线性方程组是比较类似的。比如:** $\begin{cases}x + 2y = 5\\3x+4y = 6\end{cases}$ **但这里的重点是线性,所谓线性就是,未知数只能是一次方项。像 $ ......
线性 线性代数 代数 系统

Leetcode刷题笔记——单调性

## 单调性 单调性是数学中使用的一种常见性质,通常用于描述函数,在高等数学中的定义常常为: 设函数f(x)在区间I上有定义,如果对于I上的任意两个数x1和x2,当x1f(x2)),则称函数f(x)在区间I上是单调递增的(或者单调递减的)。 例如如下图像就是两个单调函数。 ![](https://i ......
Leetcode 笔记

《线性代数》4. 矩阵的高级话题

### 更多的变换矩阵 **之前我们说矩阵可以看作是向量的函数,矩阵可以改变一个点的坐标,比如将一个点的横坐标扩大 a 倍,纵坐标扩大 b 倍,那么就可以让如下矩阵与之相乘。** $T = \begin{Bmatrix}a & 0\\0 & b\end{Bmatrix}$ **本次就来介绍更多的变换 ......
线性代数 代数 矩阵 线性 话题

Leetcode 剑指Offer 05. 替换空格(Ti huan kong ge lcof)

[题目链接](https://leetcode.cn/problems/ti-huan-kong-ge-lcof) 请实现一个函数,把字符串 s 中的每个空格替换成"%20"。 示例 1: ``` 输入:s = "We are happy." 输出:"We%20are%20happy." ``` 提 ......
空格 Leetcode Offer huan kong

[LeetCode][309]best-time-to-buy-and-sell-stock-with-cooldown

# Content You are given an array prices where prices[i] is the price of a given stock on the ith day. Find the maximum profit you can achieve. You may ......

[LeetCode 11]盛最多水的容器 二分

emmm看到这题第一反应是二分_(:з」∠)_ 首先可以观察到,假设我们目前敲定了2块板l和r,那么在l和r之间,低于l和r的板子都是无效的(这个应该显而易见)。 基于这个性质对无效板进行消除,最后会得到一个山峰形(先单调不降,后单调不升) 现在考虑对山峰形如何求解。 考虑枚举每个有效板作为边界,寻 ......
容器 LeetCode 11

《线性代数》3. 矩阵,线性代数中最重要的概念

### 什么是矩阵 **前面我们介绍了向量,它是线性代数中最基本的元素,但提到线性代数,估计更多人第一时间想到的是矩阵(Matrix)。** **$\begin{Bmatrix} 1 & 2 & 3 & 4 \\ 5 & 6 & 7 & 8 \\ 9 & 10 & 11 & 12 \end{Bmat ......
线性代数 代数 线性 矩阵 概念

Leetcode刷题之 1071. 字符串的最大公因子

# 题目描述 对于字符串 s 和 t,只有在 s = t + ... + t(t 自身连接 1 次或多次)时,我们才认定 “t 能除尽 s”。 给定两个字符串 str1 和 str2 。返回 最长字符串 x,要求满足 x 能除尽 str1 且 x 能除尽 str2 。 示例 1: 输入:str1 = ......
因子 字符串 字符 Leetcode 1071

[LeetCode][300]longest-increasing-subsequence

# Content Given an integer array nums, return the length of the longest strictly increasing subsequence. Example 1: Input: nums = [10,9,2,5,3,7,101,18 ......

Leetcode 15. 三数之和(3Sum)

[题目链接](https://leetcode.cn/problems/3sum) 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i != j、i != k 且 j != k ,同时还满足 nums[i] + nums[j] + nu ......
之和 Leetcode 3Sum Sum 15

Leetcode2788——按分隔符拆分字符串

给你一个字符串数组 words 和一个字符 separator ,请你按 separator 拆分 words 中的每个字符串。 返回一个由拆分后的新字符串组成的字符串数组,不包括空字符串 。 注意 separator 用于决定拆分发生的位置,但它不包含在结果字符串中。 拆分可能形成两个以上的字符串 ......
分隔符 字符串 字符 Leetcode 2788

LeetCode 周赛上分之旅 #42 当 LeetCode 考树上倍增,出题的趋势在变化吗

> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://www.mdnice.com/writing/85b28c4e60354865a423728e668fc570) 知识星球提问。** > > 学习数据 ......
LeetCode 趋势 之旅 42