拓扑 前缀 线性leetcode

LeetCode —— 买卖股票的最佳时机专题

121. 买卖股票的最佳时机 minPrice 维护到当天为止的最低价格 maxProfit 维护到当天我为止的最大利润 例如: [2,5,1,3], 第二天: minPrice=2 maxProfit=3; 第四天:minPrice=1 maxProfit=max(3, 3-1=2)=3; cla ......
时机 LeetCode 专题 股票

LeetCode —— 贪心

55. 跳跃游戏 如果当前数字为3,代表在这一格可以跳1或2或3格 维护一个全局最远可到达的下标 maxReach 遍历 nums 数组,如果 maxReach 小于当前下标 i ,说明现在这里就不可以到达,更别说终点了,return false 接下来就是现在这个下标可以到达的情况 现在这个下标的 ......
LeetCode

abc064d <贪心/前缀和>

[D - Insertion](https://atcoder.jp/contests/abc064/tasks/abc064_d) > [另一种做法](https://www.bilibili.com/read/cv24447317),注意这两种写法: >1. `max_element` >2. ......
前缀 064d abc 064 lt

LeetCode -- 792. 匹配子序列的单词数

方法1:利用桶的思想同时匹配所有words中的子串 (走路写法) 把所有首字母相同的子串放入到一个桶中,然后遍历s,对于首字母为s[i]的单词,若其大小为1则res ++, 否则删掉s[i],并根据s[i + 1]放入新的桶中。 c ++ class Solution { public: int n ......
序列 单词 LeetCode 792

LeetCode 206. 反转链表

``` /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode() : val(0), next(nullptr) {} * ListNode(int x ......
LeetCode 206

线性基

学了两天才学明白线性基,太痛苦了! # 前置芝士: 1. 若 $a \oplus b \oplus c=0$,则 $a \oplus b=c$ 2. 若 $a \oplus b=c$,则 $a \oplus c=b$ ### 证明: 1. 由于 $c \oplus c=0$,则 $(a \oplus ......
线性

LeetCode -- 764. 最大加号标志

利用动态规划的思想,把每个格子上下左右连续的1的个数算出来,再从头到尾遍历一遍即可获得答案。 c ++ class Solution { public: int orderOfLargestPlusSign(int n, vector<vector<int>>& mines) { vector<ve ......
加号 LeetCode 标志 764

高斯消元法求线性方程组

# 高斯消元法 - 作用 可以快速求解n元线性方程组: $$ \begin{cases} a_{11}x_1+a_{12}x_2+a_{13}x_3+\dots+a_{1n}x_n=b_1\\ a_{21}x_1+a_{22}x_2+a_{23}x_3+\dots+a_{2n}x_n=b_2\\ \ ......
方程组 线性 方程

做题日记:1881. 插入后的最大值(leetcode)

题目: >给你一个非常大的整数 n 和一个整数数字 x ,大整数 n 用一个字符串表示。n 中每一位数字和数字 x 都处于闭区间 [1, 9] 中,且 n 可能表示一个 负数 。 >你打算通过在 n 的十进制表示的任意位置插入 x 来 最大化 n 的 数值 ​​​​​​。但 不能 在负号的左边插入 ......
最大值 leetcode 日记 1881

线性基

线性基是一种擅长处理异或问题的数据结构。 可以用来: 1. 查询一个数是否可以被一堆数异或出来。 2. 查询一堆数可以异或出来的最值. 3. 查询一堆数可以异或出来的第 $k$ 大值。 以上三点均可以在 $log$ 级别的复杂度下稳定实现。 线性基本质上是一个通过对二进制的判断来从原集合中取出一些数 ......
线性

c语言刷leetcode——图

[TOC] # 0.图和树的关系 1. 树是特殊的图,且是有向图 2. 树中没有环,而图中可能有 # 1.图的存储方式 - 图由点集和边集组成 - 图分为有向图和无向图,无向图可以理解为双向有向图 ## 1.1 邻接表 和 邻接矩阵 - 常见的图存储方式由邻接表(点集为核心)和邻接矩阵(边集为核心) ......
leetcode 语言

leetcode-682.棒球比赛

```go package main import ( "strconv" ) /* * @lc app=leetcode.cn id=682 lang=golang * * [682] 棒球比赛 */ // @lc code=start func sum(numbers []int) int { ......
棒球 leetcode 682

leetcode 1466 重新规划路线 题解

### 解题思路 执行用时:140 ms, 在所有 Go 提交中击败了100.00%的用户 内存消耗:16.8 MB, 在所有 Go 提交中击败了82.00%的用户 将连接图转化成有向图,用二维slice存放。 此处将连接的起点设置为`from`也就是graph的外层下标,将连接的目标设为`targ ......
题解 leetcode 路线 1466

LeetCode 200. 岛屿数量

``` class Solution { public: bool st[310][310]; int dx[4]={0,0,-1,1},dy[4]={-1,1,0,0}; int m,n; int numIslands(vector>& g) { int res=0; n=g.size(),m=g ......
岛屿 LeetCode 数量 200

LeetCode 169. 多数元素

``` class Solution { public: int majorityElement(vector& nums) { int cnt=1; int res=nums[0]; for(int i=1;i<nums.size();i++) { if(nums[i]==res) cnt++; ......
LeetCode 元素 169

LRU 力扣 146 https://leetcode.cn/problems/lru-cache/

一道经典题目,用双向链表去做能够满足O1的复杂度 核心代码如下 class LRUCache { MyLinkedList myLinkedList; int size; int capacity; HashMap<Integer, MyNode> map; public LRUCache(int ......
lru-cache leetcode problems https cache

[LeetCode] 2024. Maximize the Confusion of an Exam

A teacher is writing a test with n true/false questions, with 'T' denoting true and 'F' denoting false. He wants to confuse the students by maximizing ......
Confusion LeetCode Maximize 2024 Exam

LeetCode

[剑指offer 05.替换空格](https://leetcode.cn/problems/ti-huan-kong-ge-lcof/) ```cpp class Solution { public: string replaceSpace(string s) { string out; for( ......
LeetCode

leetcode649队列操作Dota2

基本操作 入队: queue.push() queue.push_back()//两者效果相同 出队: queue.pop(); queue.pop_back();//都从尾部操作 考虑两个因素:1.每个参议员的决定都由之后的参议员决定 2.决定禁用之后都不能在投票 queue<int>radian ......
队列 leetcode Dota2 Dota 649

dumpbin工具使用-由zlib编译前缀少加预处理器命令引起的异常-扩展

对zlib使用vs2019编译,没有在预处理器中加前缀命令,导致编译出来的zlib.dll 与项目之前使用的函数名不一致,运行报错。 报错信息:无法在DLL“libz64”中找到名为“Z_inflateEnd”的入口点。 在z.conf 中有以下注释: /* * If you *really* ne ......
前缀 命令 dumpbin 工具 zlib

在FreeSWITCH中,通过拨号计划实现主叫008615098889958的号码变成15098889958,也就是去掉前缀0086,怎么实现?

在FreeSWITCH中,通过拨号计划实现主叫号码008615098889958的号码变成15098889958,即去掉前缀0086,你可以按照以下步骤进行设置: 打开FreeSWITCH配置文件,通常是 freeswitch/conf/dialplan/default.xml。 在文件中找到 <c ......

[LeetCode] 2178. Maximum Split of Positive Even Integers

You are given an integer finalSum. Split it into a sum of a maximum number of unique positive even integers. For example, given finalSum = 12, the fol ......
LeetCode Integers Positive Maximum Split

[LeetCode] 2600. K Items With the Maximum Sum

There is a bag that consists of items, each item has a number 1, 0, or -1 written on it. You are given four non-negative integers numOnes, numZeros, n ......
LeetCode Maximum Items 2600 With

Leetcode: Algorithm

1. Boyer-Moore Voting Algorithm identify the majority element (frequency > n/2) class Solution { public int majorityElement(int[] nums) { int count = ......
Algorithm Leetcode

leetcode-1652-easy

Defuse the Bomb ``` You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n ......
leetcode 1652 easy

leetcode-1629-easy

Slowest Key ``` You have a bomb to defuse, and your time is running out! Your informer will provide you with a circular array code of length of n and ......
leetcode 1629 easy

LeetCode 160. 相交链表

``` /** * Definition for singly-linked list. * struct ListNode { * int val; * ListNode *next; * ListNode(int x) : val(x), next(NULL) {} * }; */ class ......
LeetCode 160

【笔试实战】LeetCode题单刷题-编程基础 0 到 1【三】

博客推行版本更新,成果积累制度,已经写过的博客还会再次更新,不断地琢磨,高质量高数量都是要追求的,工匠精神是学习必不可少的精神。因此,大家有何建议欢迎在评论区踊跃发言,你们的支持是我最大的动力,你们敢投,我就敢肝 ......
笔试 实战 LeetCode 基础

坚固型3DMAG™A31315LOLATR-XZ-S-AR-10、A31315LOLATR-XY-S-SE-10霍尔效应 线性,旋转位置 外磁铁

A31315 3D磁性位置传感器IC是完全集成的坚固型3DMAG™ 霍尔效应磁性位置传感器IC,主要用于支持汽车、工业和消费类应用中的各种非接触式旋转和线性位置测量。 此传感器IC符合AEC-Q100 0级的要求,并根据ISO 26262进行开发。这些标准使A31315成为了要求严格的汽车安全系统的 ......

硬件知识之(低压差线性稳压器)LDO的选择

.低压差线性稳压器 低压差线性稳压器是新一代的集成电路稳压器,它与三端稳压器最大的不同点在于,低压差线性稳压器(ldo)是一个自耗很低的微型片上系统(soc)。它可用于电流主通道控制,芯片上集成了具有极低线上导通电阻的mosfet,肖特基二极管、取样电阻和分压电阻等硬件电路,并具有过流保护、过温保护 ......
硬件知识 稳压器 线性 低压 硬件