rectangle leetcode number ships

LeetCode 206 反转链表,LeetCode 92反转链表Ⅱ

206. 反转链表 给你单链表的头节点 head ,请你反转链表,并返回反转后的链表。 示例 1: 输入:head = [1,2,3,4,5] 输出:[5,4,3,2,1] 示例 2: 输入:head = [1,2] 输出:[2,1] 示例 3: 输入:head = [] 输出:[] 提示: 链表中 ......
LeetCode 206

LeetCode -- 722. 删除注释

利用双指针来进行删除操作 class Solution { public: vector<string> removeComments(vector<string>& source) { string str; for(auto it : source) str += it + "'"; int n ......
注释 LeetCode 722

LeetCode 3. 无重复字符的最长子串

``` class Solution { public: int res=0; int lengthOfLongestSubstring(string s) { int n=s.size (); if(!n) return 0; bool st[128]={false}; for(int j=0,i ......
字符 LeetCode

UVA12462 Rectangle

# UVA12462 Rectangle [题目传送门](https://www.luogu.com.cn/problem/UVA12462) ##### 可以说是广告印刷的加强版。 ## 题目大意 有 $n$ 个矩形依次相邻,$m$ 种颜色。第 $i$ 个矩形高度 $h_i$,宽度为 $1$,颜色 ......
Rectangle 12462 UVA

LeetCode从算法到算命—每日一题(0804)

# 980.不同路径III ## 题目信息 在二维网格 `grid` 上,有 4 种类型的方格: - `1` 表示起始方格。且只有一个起始方格。 - `2` 表示结束方格,且只有一个结束方格。 - `0` 表示我们可以走过的空方格。 - `-1` 表示我们无法跨越的障碍。 返回在四个方向(上、下、左 ......
算法 LeetCode 0804

LeetCode 739. 每日温度

``` class Solution { public: vector dailyTemperatures(vector& t) { stack st; int n=t.size(); vector res(n); for(int i=n-1;i>=0;i--) { while(st.size()& ......
LeetCode 温度 739

LeetCode -- 980. 不同路径 III

本题让我们求不相交路径数目 方法1:递归/回溯 dfs(x, y, left) 表示从点x, y出发,还剩下left个可行走点的路径数目。 每行走到一个新的点就将该点设置为-1, 避免重复搜索。 当走到终点时,如果left == 0 则答案 + 1 class Solution { int dfs( ......
路径 LeetCode 980 III

[LeetCode] 980. Unique Paths III

You are given an m x n integer array grid where grid[i][j] could be: 1 representing the starting square. There is exactly one starting square. 2 repre ......
LeetCode Unique Paths 980 III

代码随想录算法训练营第八天| LeetCode 344.反转字符串 541. 反转字符串II 151.翻转字符串里的单词

344.反转字符串 卡哥建议: 本题是字符串基础题目,就是考察 reverse 函数的实现,同时也明确一下 平时刷题什么时候用 库函数,什么时候 不用库函数 题目链接/文章讲解/视频讲解:https://programmercarl.com/0344.%E5%8F%8D%E8%BD%AC%E5%AD ......
字符串 字符 随想录 训练营 随想

LeetCode 热题 100 之 48. 旋转图像

# 题目 给定一个 n × n 的二维矩阵 matrix 表示一个图像。请你将图像顺时针旋转 90 度。 你必须在 原地 旋转图像,这意味着你需要直接修改输入的二维矩阵。请不要 使用另一个矩阵来旋转图像。 ![image](https://img2023.cnblogs.com/blog/22041 ......
LeetCode 图像 100 48

LeetCode 热题 100 之 54. 螺旋矩阵

# 题目 给你一个 m 行 n 列的矩阵 matrix ,请按照 顺时针螺旋顺序 ,返回矩阵中的所有元素。 **示例 1:** ![image](https://img2023.cnblogs.com/blog/2204134/202308/2204134-20230803145822194-967 ......
矩阵 螺旋 LeetCode 100 54

leetcode647. 回文子串

``` class Solution { public: int res=0; int countSubstrings(string s) { int n=s.size(); for(int i=0;i=0&&r=0&&r<n&&s[l]==s[r]) l--,r++,res++; } return ......
回文 leetcode 647

LeetCode从算法到算命——每日一题(0802)

LeetCode从算法到算命—每日一题(0802) # 822. 翻转卡片游戏 ## 题目信息 在桌子上有 n 张卡片,每张卡片的正面和背面都写着一个正数(正面与背面上的数有可能不一样)。 我们可以先翻转任意张卡片,然后选择其中一张卡片。 如果选中的那张卡片背面的数字 x 与任意一张卡片的正面的数字 ......
算法 LeetCode 0802

LeetCode 热题 100 之 73. 矩阵置零

# 题目 给定一个 m x n 的矩阵,如果一个元素为 0 ,则将其所在行和列的所有元素都设为 0 。请使用 原地 算法。 **示例 1:** 输入:matrix = [[1,1,1],[1,0,1],[1,1,1]] 输出:[[1,0,1],[0,0,0],[1,0,1]] **示例 2:** 输 ......
矩阵 LeetCode 100 73

(*)LeetCode 热题 100 之 238. 除自身以外数组的乘积

# 题目 给你一个整数数组 nums,返回 数组 answer ,其中 answer[i] 等于 nums 中除 nums[i] 之外其余各元素的乘积 。 题目数据 保证 数组 nums之中任意元素的全部前缀元素和后缀的乘积都在 32 位 整数范围内。 请**不要使用除法**,**且在 O(n) 时 ......
乘积 数组 LeetCode 100 238

LeetCode 热题 100 之 189. 轮转数组

# 题目 给定一个整数数组 nums,将数组中的元素向右轮转 k 个位置,其中 k 是非负数。 **示例 1:** 输入: nums = [1,2,3,4,5,6,7], k = 3 输出: [5,6,7,1,2,3,4] 解释: 向右轮转 1 步: [7,1,2,3,4,5,6] 向右轮转 2 步 ......
数组 LeetCode 100 189

代码随想录算法训练营第七天| LeetCode 454.四数相加II 15. 三数之和 18. 四数之和

454.四数相加II 卡哥建议:本题是使用map巧妙解决的问题,好好体会一下 哈希法如何提高程序执行效率,降低时间复杂度,当然使用哈希法会提高空间复杂度,但一般来说我们都是舍空间换时间, 工业开发也是这样。 题目链接/文章讲解/视频讲解:https://programmercarl.com/0454 ......
之和 随想录 训练营 随想 算法

LeetCode 周赛上分之旅 # 36 KMP 字符串匹配殊途同归

> ⭐️ **本文已收录到 AndroidFamily,技术和职场问题,请关注公众号 \[彭旭锐] 和 [BaguTree Pro](https://files.mdnice.com/user/3257/de950859-eb71-4821-a36b-bebe5cff500d.png) 知识星球提问 ......

Jenkins:重置 job build number

在调试jenkins job时会产生很多fail的build,很多**红色的X**还是很碍眼的,job调试成功后就可以重置build number了。 ### 步骤: 1. 点击jenkins小老头图标 -> 管理Jenkins ![](https://img2023.cnblogs.com/blo ......
Jenkins number build job

LeetCode 581. 最短无序连续子数组

``` class Solution { public: int findUnsortedSubarray(vector& nums) { int n=nums.size(); int l=0,r=n-1; while(l0&&nums[r]>=nums[r-1]) r--; int min_num ......
数组 LeetCode 581

第 356 场周赛 - 力扣(LeetCode)

# [第 356 场周赛 - 力扣(LeetCode)](https://leetcode.cn/contest/weekly-contest-356/) ## [2798. 满足目标工作时长的员工数目 - 力扣(LeetCode)](https://leetcode.cn/problems/num ......
LeetCode 356

LeetCode 543. 二叉树的直径

``` /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(nullptr), ......
直径 LeetCode 543

[LeetCode] 712. Minimum ASCII Delete Sum for Two Strings

Given two strings s1 and s2, return the lowest ASCII sum of deleted characters to make two strings equal. Example 1: Input: s1 = "sea", s2 = "eat" Out ......
LeetCode Minimum Strings Delete ASCII

代码随想录算法训练营第三天| LeetCode 242.有效的字母异位词 349. 两个数组的交集 1. 两数之和

242.有效的字母异位词 卡哥建议: 这道题目,大家可以感受到数组用来做哈希表给我们带来的遍历之处。 题目链接/文章讲解/视频讲解: https://programmercarl.com/%E5%93%88%E5%B8%8C%E8%A1%A8%E7%90%86%E8%AE%BA%E5%9F%BA%E ......
随想录 之和 训练营 数组 交集

leetcode-n-sum总结

总结一下leetcode中遇见的2-sum, 3-sum, 4-sum问题,并扩展到n-sum。 1. 两数之和 - 力扣(LeetCode) 梦开始的地方,不多说。 class Solution { public int[] twoSum(int[] nums, int target) { Map ......
leetcode-n-sum leetcode sum

LeetCode/课程表IV

你总共需要上 numCourses 门课,课程编号依次为 0 到 numCourses-1 。你会得到一个数组 prerequisite ,其中 prerequisites[i] = [ai, bi] 表示如果你想选 bi 课程,你 必须 先选 ai 课程。 有的课会有直接的先修课程,比如如果想上课 ......
课程表 LeetCode 课程

Number Theory: The set of Real实数系构造:实数公理化(R, +, ×, ≥)之Field/Order/Continuity + Dedkind分割

Number Theory: The set of Real实数系构造 实数公理化(R, +, ×, ≥)之Field/Order/Continuity F(域):定义 +, ×, ≥: +: 加法的 交换律、结合律、0单位元、负元 ×: 乘法的 交换律、结合律、1单位元、逆元、乘法×对加法+的分配 ......
实数 公理化 Continuity Dedkind Number

leetcode-异位词问题总结

总结一下leetcode中遇见的异位词问题: 242. 有效的字母异位词 - 力扣(LeetCode) 本题是异位词题目中最基础的,有两种方法可以轻松解决: 1. 排序法,时间复杂度O(n log n): class Solution { //排序解决 public boolean isAnagra ......
leetcode 问题

leetcode第353场周赛 4 - 差分数组维护区间修改

[题目传送门](https://leetcode.cn/contest/weekly-contest-353/) # [2772. 使数组中的所有元素都等于零](https://leetcode.cn/problems/apply-operations-to-make-all-array-eleme ......
数组 区间 leetcode 353