拓扑 前缀 线性leetcode

[LeetCode][152]maximum-product-subarray

# Content Given an integer array nums, find a subarray that has the largest product, and return the product. The test cases are generated so that the ......

[LeetCode][139]word-break

# Content Given a string s and a dictionary of strings wordDict, return true if s can be segmented into a space-separated sequence of one or more dict ......
word-break LeetCode break word 139

Leetcode——1957、删除字符使字符串变好

一个字符串如果没有 三个连续 相同字符,那么它就是一个 好字符串 。 给你一个字符串 s ,请你从 s 删除 最少 的字符,使它变成一个 好字符串 。 请你返回删除后的字符串。题目数据保证答案总是 唯一的 。 示例 1: 输入:s = "leeetcode" 输出:"leetcode" 解释: 从第 ......
字符 字符串 Leetcode 1957

[LeetCode][124]binary-tree-maximum-path-sum

# Content A path in a binary tree is a sequence of nodes where each pair of adjacent nodes in the sequence has an edge connecting them. A node can onl ......

Leetcode 1. 两数之和(Two sum)

[题目链接🔗](https://leetcode.cn/problems/two-sum) 给定一个整数数组 nums 和一个整数目标值 target,请你在该数组中找出 和为目标值 target 的那 两个 整数,并返回它们的数组下标。 你可以假设每种输入只会对应一个答案。但是,数组中同一个元素 ......
之和 Leetcode Two sum

ML——三、线性代数回顾(Linear Algebra Review)

3.1 矩阵和向量 这一节对矩阵和向量的概念进行描述,不再赘述。 3.2 加法和标量乘法 矩阵和矩阵的加法:对应元素相加 矩阵和标量乘法:矩阵的每个元素都与标量相乘 3.3 矩阵向量乘法 以及 3.4 矩阵乘法 都可以看作是矩阵乘法,第i行乘第j列,对应元素相乘再相加,然后放到结果矩阵的第i行第j列 ......
线性代数 代数 线性 Algebra Linear

[LeetCode] 1267. Count Servers that Communicate

You are given a map of a server center, represented as a m * n integer matrix grid, where 1 means that on that cell there is a server and 0 means that ......
Communicate LeetCode Servers Count 1267

Leetcode 1782. 统计点对的数目

这两天实训比较忙,之后补 TRANSLATE with x English Arabic Hebrew Polish Bulgarian Hindi Portuguese Catalan Hmong Daw Romanian Chinese Simplified Hungarian Russian ......
数目 Leetcode 1782

leetcode 12

![image](https://img2023.cnblogs.com/blog/3254178/202308/3254178-20230823182631200-1538353557.png) ### 算法介绍: - **哈希** - **贪心** - 实现代码如下 ```cpp class S ......
leetcode 12

【线性代数】第五章 特征值和特征向量

#### 1.特征值和特征向量 **特征值和特征向量的定义:** 对于n阶矩阵A,如果存在一个数λ以及非零n维列向量α,使得 **Aα = λα** 成立 则称λ是矩阵A的一个**特征值**。非零向量α是**矩阵A属于特征值的一个特征向量**。 >这个式子可以写成**(λE-A)α = 0,α≠0* ......
特征值 特征 线性代数 向量 代数

【模板】拓扑排序

# 拓扑排序 拓扑排序是一种适用于有向无环图(简称DAG)中的算法,它拥有较低的复杂度,较简单的代码难度。 ##### 什么是有向无环图? 对于一张有向图,倘若一条边的终点无法通过其他路径指向起点,那么这张图就可以称作有向无环图。 ##### 拓扑排序在什么时候适用? 首先题目中涉及到的图需要是DA ......
拓扑 模板

线性基学习笔记

$#defing ll long long$ 线性基用处: 快速查询一个数是否可以被一堆数异或出来 快速查询一堆数可以异或出来的最大 $/$ 最小值 快速查询一堆数可以异或出来的第 $k$ 大值 线性基空间复杂度: 设有一个序列,其值域为 $[1,N]$,我们可以构造一个长度为 $⌈\log_2 N ......
线性 笔记

Leetcode605——种花问题

假设有一个很长的花坛,一部分地块种植了花,另一部分却没有。可是,花不能种植在相邻的地块上,它们会争夺水源,两者都会死去。 给你一个整数数组 flowerbed 表示花坛,由若干 0 和 1 组成,其中 0 表示没种植花,1 表示种植了花。另有一个数 n ,能否在不打破种植规则的情况下种入 n 朵花? ......
Leetcode 问题 605

Leetcode 202. 快乐数(Happy number)

[题目链接🔗](https://leetcode.cn/problems/happy-number) 编写一个算法来判断一个数 n 是不是快乐数。 「快乐数」 定义为: 对于一个正整数,每一次将该数替换为它每个位置上的数字的平方和。 然后重复这个过程直到这个数变为 1,也可能是 无限循环 但始终变 ......
Leetcode number Happy 202

[LeetCode][121]best-time-to-buy-and-sell-stock

# Content You are given an array prices where prices[i] is the price of a given stock on the ith day. You want to maximize your profit by choosing a s ......

[LeetCode][96]unique-binary-search-trees

# Content Given an integer n, return the number of structurally unique BST's (binary search trees) which has exactly n nodes of unique values from 1 t ......

LeetCode 算法题解之 26 进制转换 All In One

LeetCode 算法题解之 26 进制转换 All In One 171. Excel Sheet Column Number 171. Excel 工作表列号 168. Excel Sheet Column Title 168. Excel 工作表列头 ......
题解 进制 算法 LeetCode All

2023-08-23 vuetifyjs icon用法 ==》 前缀mdi-加上icon名称

我现在用的是最新3.0版本的vuetifyjs,它的icon库来自👉https://pictogrammers.com/library/mdi/icon/pan-right/ 写法为在v-icon容器中写入前缀“mdi-”+icon名称,如: <v-icon>mdi-chevron-right</ ......
前缀 icon vuetifyjs 名称 2023

Leetcode 459——重复的子字符串

给定一个非空的字符串 s ,检查是否可以通过由它的一个子串重复多次构成。 示例 1: 输入: s = "abab" 输出: true 解释: 可由子串 "ab" 重复两次构成。 示例 2: 输入: s = "aba" 输出: false 示例 3: 输入: s = "abcabcabcabc" 输出 ......
字符串 字符 Leetcode 459

[LeetCode][72]edit-distance

# Content Given two strings word1 and word2, return the minimum number of operations required to convert word1 to word2. You have the following three ......
edit-distance LeetCode distance edit 72

[LeetCode][85]maximal-rectangle

# Content Given a rows x cols binary matrix filled with 0's and 1's, find the largest rectangle containing only 1's and return its area. Example 1: In ......

Leetcode 349.两个数组的交集(Intersection of two arrays)

[题目链接🔗](https://leetcode.cn/problems/intersection-of-two-arrays) 给定两个数组 nums1和 nums2 ,返回 它们的交集 。输出结果中的每个元素一定是 唯一 的。我们可以 不考虑输出结果的顺序 。 示例 1: ``` 输入:num ......
数组 交集 Intersection Leetcode 两个

字典树(前缀树)求区间异或和(异或对)最大值

字典树(前缀树)求区间异或和(异或对)最大值 求子区间异或对最大值 求子区间异或对的最大值,利用前缀树可以在每次询问对子区间内的每个元素在O(log n)的时间内得到答案,执行n此的时间花费为O(n logn),而得到答案需要已经建立前缀树,而每次询问答案都需要重新建立一棵前缀树,每次建树最坏情况下 ......
最大值 前缀 区间 字典

Leetcode 849. 到最近的人的最大距离

# 题目描述 给你一个数组 seats 表示一排座位,其中 seats[i] = 1 代表有人坐在第 i 个座位上,seats[i] = 0 代表座位 i 上是空的(下标从 0 开始)。 至少有一个空座位,且至少有一人已经坐在座位上。 亚历克斯希望坐在一个能够使他与离他最近的人之间的距离达到最大化的 ......
Leetcode 849

ML—— 二、单变量线性回归(Linear Regression with One Variable)

2.1 模型表示 本节将通过线性回归来了解监督学习的过程: 对于房价预测模型,我们之所以将其称为监督学习(因为对每个数据都有一个正确答案-真实的房价)。由于房价是一些连续的值,因此这是一个回归问题。 h代表学习算法的解决方案或函数也称为假设(hypothesis),监督学习算法的工作方式如下 要解决 ......
线性 变量 Regression Variable Linear

Leetcode 两个队列实现栈 swift

queue1 是最后生成的栈 queue2 是临时队列,把新进来的先放进去,再把queue1里的数据从头到尾读进去,然后互换 class MyStack { var queue1: [Int] = [] var queue2: [Int] = [] init() { } func push(_ x: ......
队列 Leetcode 两个 swift

[LeetCode] 2337. Move Pieces to Obtain a String

You are given two strings start and target, both of length n. Each string consists only of the characters 'L', 'R', and '_' where: The characters 'L'  ......
LeetCode Pieces Obtain String 2337

第 111 场双周赛 - 力扣(LeetCode)

# [第 111 场双周赛 - 力扣(LeetCode)](https://leetcode.cn/contest/biweekly-contest-111/) ## [2824. 统计和小于目标的下标对数目 - 力扣(LeetCode)](https://leetcode.cn/problems/ ......
LeetCode 111

R语言lasso惩罚稀疏加法(相加)模型SPAM拟合非线性数据和可视化

全文链接:https://tecdat.cn/?p=33462 原文出处:拓端数据部落公众号 本文将关注R语言中的LASSO(Least Absolute Shrinkage and Selection Operator)惩罚稀疏加法模型(Sparse Additive Model,简称SPAM)。 ......
加法 非线性 模型 语言 数据

非线性规划代码

对于非线性规划问题,可以使用Python中的优化库来进行求解。其中,scipy.optimize.minimize() 函数提供了多种非线性优化算法,可以用于求解非线性规划问题。下面是一个使用Scipy库进行非线性规划求解的示例代码: `pip install scipy` 然后,可以使用以下代码编 ......
非线性 代码