矩阵leetcode 100 240
[LeetCode] 2422. Merge Operations to Turn Array Into a Palindrome
You are given an array nums consisting of positive integers. You can perform the following operation on the array any number of times: Choose any two ......
[LeetCode] 1676. Lowest Common Ancestor of a Binary Tree IV
Given the root of a binary tree and an array of TreeNode objects nodes, return the lowest common ancestor (LCA) of all the nodes in nodes. All the nod ......
LeetCode之0661, 二维向量初始化
img[i][j]周围的单元格,img[i+i1][j+j1], i1=-1,0,1, j1=-1,0,1, 每个都判断一次。O(9*m*n) class Solution { public: std::vector<std::vector<int>> imageSmoother( std::vec ......
Leetcode之0709, 修改字符串
1 class Solution { 2 public: 3 string toLowerCase(string s) { 4 for(char &ch: s){ 5 if(ch>='A' && ch<='Z'){ 6 ch=tolower(ch); 7 } 8 } 9 return s; 10 } ......
汽车tbox通讯矩阵数据库创建流程
汽车tbox通讯矩阵数据库创建流程 1. 先配置本机的环境变量,注意是在bin目录下 2. 打开本机phpstudy 确认3306端口未被占用 3. 打开mysql所在文件夹路径cmd指令,输入mysql -u root -p,进入数据库 4. 我们先输入create database tel; 来 ......
[LeetCode] 2486. Append Characters to String to Make Subsequence
You are given two strings s and t consisting of only lowercase English letters. Return the minimum number of characters that need to be appended to th ......
[刷题记录Day4]Leetcode链表专题
# No.1 ## 题目 [两两交换链表中的节点](https://leetcode.cn/problems/swap-nodes-in-pairs/) ## 思路 - 模拟类型题目 - 两个节点前后交换,同时记住原来的下一个节点 - 虚拟头节点 ## 代码 ```Java public ListN ......
LeetCode 1201. Ugly Number III 数学+二分答案
An ugly number is a positive integer that is divisible by $a$, $b$, or $c$. Given four integers $n$, $a$, $b$, and $c$, return the $n$th ugly number. ......
LeetCode 875. Koko Eating Bananas 二分答案
Koko loves to eat bananas. There are $n$ piles of bananas, the $i$th pile has $piles[i]$ bananas. The guards have gone and will come back in `h` hours ......
浅谈关系矩阵
# 浅谈关系矩阵 ## 什么是关系矩阵 关系矩阵就是用矩阵来表示关系,关系矩阵中的数值皆为**0**或**1**(也就是**bool**型)。 + 举个例子: $$ \begin{vmatrix} 1& 0& 1\\ 0& 0& 1\\ 1& 0& 0 \end{vmatrix} $$ + 这个关系 ......
线性代数4 初等变换、初等矩阵、分块矩阵、方阵行列式
#### 1.1初等变换和初等矩阵的概念 **初等变换的概念:** 初等变换并不是一个运算操作,而是一类对矩阵的操作的统称 对于m×n矩阵A: (1)倍乘:对A的某行或某列元素乘上一个非零常数k (2)互换:互换A的某两列或某两行元素的位置 (3)倍加:将A的某行或某列元素的k倍加到另一行或列上 这 ......
LeetCode 1011. Capacity To Ship Packages Within D Days 二分答案
A conveyor belt has packages that must be shipped from one port to another within `days` days. The ith package on the conveyor belt has a weight of $w ......
随笔(二十五)『3个线程交替输出1-100、交替输出ABC』
#### 1、3个线程交替输出1-100 ``` /** * 需求: * 3个线程交替输出1-100 */ public class TestPrint1_100 { private Integer state = 1; // 状态值1-t1执行, 2-t2执行, 3-t3执行 private In ......
leetcode练习
## 分类 题单:[code](#code) 难度:[简单](#Simple) [中等](#middle) [困难](#hard) 类型:[数组](#数组) [链表](#链表) [字符串](#字符串) [二叉树](#二叉树) [排序](#排序) 解法:[递归和迭代](#递归和迭代) [滑动窗口 ]( ......
leetcode 546. 移除盒子
1. 题目 读题 链接:https://www.nowcoder.com/questionTerminal/a5390d76441647fbb182f34bee6a1ca7来源:牛客网一维消消乐 小v在vivo手机的应用商店中下载了一款名为“一维消消乐”的游戏,介绍如下: 1、给出一些不同颜色的豆子 ......
Java 生成旋螺矩阵
@Test public void virtualMain() { int[][] matrix = generateMatrix(9); MyArray.printSquareArray(matrix, 2); } public int[][] generateMatrix(int n) { in ......
[LeetCode] 2461. Maximum Sum of Distinct Subarrays With Length K
You are given an integer array nums and an integer k. Find the maximum subarray sum of all the subarrays of nums that meet the following conditions: T ......
[LeetCode] 2222. Number of Ways to Select Buildings
You are given a 0-indexed binary string s which represents the types of buildings along a street where: s[i] = '0' denotes that the ith building is an ......
Leetcode日记
| 日期 | 题号 | 题目 | 解法 | 难度 | | | | | | | | 2023-07-11 | 2741 | [给定一个互不相同的正整数数组,找出**特别排列**(相邻元素互模任一为0)的总数目。取余](https://leetcode.cn/problems/special-permu ......
[LeetCode] 874. Walking Robot Simulation
A robot on an infinite XY-plane starts at point (0, 0) facing north. The robot can receive a sequence of these three possible types of commands: -2: T ......
[LeetCode] 2597. The Number of Beautiful Subsets
You are given an array nums of positive integers and a positive integer k. A subset of nums is beautiful if it does not contain two integers with an a ......
matlab创建字符矩阵
如果字符串使用 ‘’ (单引号)括起来,则使用 A = [], A = [A, str] 这种创建矩阵的方式只会导致“字符串连接” 如果字符串使用 “ ”(双引号)括起来,则使用 A = [], A = [A, str] 这种创建矩阵的方式能够创建矩阵 ......
LeetCode 852. Peak Index in a Mountain Array 二分
An array arr a mountain if the following properties hold: * `arr.length` >= 3 * There exists some i with `0 arr[i + 1] > ... > arr[arr.length - 1] ``` ......
leetcode104二叉树搜索
深度优先搜索,递归 maxDepth(TreeNode* root){ if(!root)return 0; return max(maxDepth(root->left),maxDepth(root->right))+1; } 广度优先搜索,队列 queue<TreeNode*>q; q.push ......
LeetCode 301. 删除无效的括号
``` class Solution { public: vector ans; vector removeInvalidParentheses(string s) { //lr分别记录要删除的左右括号数量 int l=0,r=0; for(auto c:s) if(c=='(') l++; els ......
蛇形矩阵
title: 蛇形矩阵 date: 2023-07-18 08:41:17 tags: - c/c++ categories: - 算法 - 笔试 top: ### 蛇形矩阵 题目来之acwing #### [题目(点击跳转)](https://www.acwing.com/problem/cont ......
[LeetCode] 1851. Minimum Interval to Include Each Query
You are given a 2D integer array intervals, where intervals[i] = [lefti, righti] describes the ith interval starting at lefti and ending at righti (in ......
正则表达式太慢?这里有一个提速100倍的方案
“当遇到一个文本处理问题时,如果你在第一时间想到了正则表达式,那么恭喜你,你的问题从一个变成了俩!“ 如果你曾参与过文本数据分析,正则表达式(Regex)对你来说一定不陌生。词库索引、关键词替换……正则表达式的强大功能使其成为了文本处理的必备工具。然而, 在处理大文本的情境下,正则表达式的低效率却常 ......
240-960MHz带编码器的单片OOK 发射器CMT2157B
CMT2157B 是一款真正意义上的单芯片、高灵活性、超低功耗、带编码器的OOK 射频发射芯片,非常适合于240 至960 MHz 的无线应用场合。该芯片可实现完全兼容市面上最常用的527、1527、2262 和2240 等编码格式。此外,还支持用户各种自定义编码。该芯片支持4个独立按键或多达10 ......
leetcode2130反转链表
1尾插法:记录前面的节点,使后面的节点指向前面的节点;记后面的节点为now。因为要不停移动now,使其移动所以要临时记录原来之后的节点。 ListNode* now=slow->next; ListNode* pre=nullptr; while(now){ ListNode* node=now-> ......