leetcode位置35
[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 } ......
[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 ......
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 ......
【安全学习之路】Day35
![](https://img2023.cnblogs.com/blog/3073714/202307/3073714-20230719161253166-355453915.png) ![](https://img2023.cnblogs.com/blog/3073714/202307/30737 ......
leetcode练习
## 分类 题单:[code](#code) 难度:[简单](#Simple) [中等](#middle) [困难](#hard) 类型:[数组](#数组) [链表](#链表) [字符串](#字符串) [二叉树](#二叉树) [排序](#排序) 解法:[递归和迭代](#递归和迭代) [滑动窗口 ]( ......
leetcode 546. 移除盒子
1. 题目 读题 链接:https://www.nowcoder.com/questionTerminal/a5390d76441647fbb182f34bee6a1ca7来源:牛客网一维消消乐 小v在vivo手机的应用商店中下载了一款名为“一维消消乐”的游戏,介绍如下: 1、给出一些不同颜色的豆子 ......
[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 ......
(笔记)位置式PID与增量式PID区别浅析
一、PID控制算法 什么是PID PID 控制器以各种形式使用超过了 1 世纪,广泛应用在机械设备、气动设备 和电子设备.在工业应用中PID及其衍生算法是应用最广泛的算法之一,是当之无愧的万能算法 PID 实指“比例 proportional”、“积分 integral”、“微分 derivativ ......
[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 ......
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] ``` ......
1-22 编写一个程序,把较长的输入行“折”成短一些的两行或多行,折行的位置 在输入行的第 n 列之前的最后一个非空格之后。要保证程序能够智能地处理输入行很长以及 在指定的列前没有空格或制表符时的情况
# Archlinux GCC 13.1.1 20230429 2023-07-18 17:32:11 星期二 点击查看代码 ``` #include #define SIGN 12 //折行记号(字符数) int main() { int c_in, c_cnt; c_in = c_cnt = 0 ......
leetcode104二叉树搜索
深度优先搜索,递归 maxDepth(TreeNode* root){ if(!root)return 0; return max(maxDepth(root->left),maxDepth(root->right))+1; } 广度优先搜索,队列 queue<TreeNode*>q; q.push ......
glTexImage2D: 读取位置XXX时发生访问冲突。
加载图片纹理时,在glGenerateMipmap(GL_TEXTURE_2D)处报错:读取位置XXX时发生访问冲突。出现这个错误,有可能是在glTexImage2D中设置错误,也有可能是加载图片的问题。 ......
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 ......
[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 ......
1-20 编写程序 detab,将输入中的制表符替换成适当数目的空格,使空格充满到 下一个制表符终止位的地方。假设制表符终止位的位置是固定的,比如每隔 n 列就会出现一 个制表符终止位。n 应该作为变量还是符号常量呢?
# Archlinux GCC 13.1.1 20230429 2023-07-17 10:30:52 星期一 制表符的作用是将光标移至最接近8的整数倍的位置,比如1~8 > 9,9~16 > 17等等,我常用制表符为4width,所以,1~4 > 5, 5~8 > 9... 点击查看代码 ``` ......
leetcode2130反转链表
1尾插法:记录前面的节点,使后面的节点指向前面的节点;记后面的节点为now。因为要不停移动now,使其移动所以要临时记录原来之后的节点。 ListNode* now=slow->next; ListNode* pre=nullptr; while(now){ ListNode* node=now-> ......
35软件测试类型
测试类型分动态测试、静态测试。测试是为了找出错误 动态测试是运用计算机运行,通过输入值得到结果的方式,动态测试主要有 白盒测试’、黑盒测试、灰盒测试 静态测试是运用人工和计算机辅助分析,静态测试主要是桌前检查、代码审查、代码走查 静态测试具体又有: 控制流分析:分析哪个区域没有到达,哪个区域没有开放 ......
8-102-(LeetCode- 207&210) 课程表II
1. 题目 读题 210. 课程表 II 考查点 2. 解法 思路 这道题的解答思路是使用拓扑排序来判断有向图是否有环,如果有环,说明无法完成所有课程,如果没有环,输出拓扑排序的结果。拓扑排序的基本思想是从有向图中选择一个没有前驱(即入度为0)的顶点并输出,然后从图中删除该顶点和所有以它为起点的有向 ......
RelativeLayout 动态设置位置
## 动态设置左对齐 ```java TextView tvName = holder.getView(R.id.tv_name); RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) tvName.getLayout ......
LeetCode 287. 寻找重复数
``` class Solution { public: int findDuplicate(vector& nums) { if(nums.size()<2) return nums[0]; int n=nums.size(); int fast=0,slow=0; do { slow=nums[ ......
LeetCode 热题 100 之 160. 相交链表
# 题目描述 给你两个单链表的头节点 headA 和 headB ,请你找出并返回两个单链表相交的起始节点。如果两个链表不存在相交节点,返回 null 。 图示两个链表在节点 c1 开始相交: ![image](https://img2023.cnblogs.com/blog/2204134/202 ......