leetcode anagrams string find
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 ......
.NET Core中关于阿拉伯语环境下的坑:Input string was not in a correct format.
### 结论 .NET Core项目(.NET Framework没出现)在阿拉伯语(即语言名称是`ar-`开头的语言)环境下,将负数字符串转成数字,即`int.Parse("-1")`或`Convert.ToInt32("-1")`时,会抛出异常“Input string was not in a ......
leetcode练习
## 分类 题单:[code](#code) 难度:[简单](#Simple) [中等](#middle) [困难](#hard) 类型:[数组](#数组) [链表](#链表) [字符串](#字符串) [二叉树](#二叉树) [排序](#排序) 解法:[递归和迭代](#递归和迭代) [滑动窗口 ]( ......
leetcode 546. 移除盒子
1. 题目 读题 链接:https://www.nowcoder.com/questionTerminal/a5390d76441647fbb182f34bee6a1ca7来源:牛客网一维消消乐 小v在vivo手机的应用商店中下载了一款名为“一维消消乐”的游戏,介绍如下: 1、给出一些不同颜色的豆子 ......
HDU 5492 Find a path 题解
# Description 在矩阵中,找一条到从 $(1,1)$ 到 $(n,m)$(只能向上,右走)的路径,使路径上方差最小。输出方差平方乘 $n+m-1$ 的结果。 对于所有数据,$1\leq n,m,A_{i,j}\leq30$。 # Solution 设路径上的数为 $A_{1},A_{2} ......
[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 ......
Could not find compile target android-33 for modules :app
检查一下这些地方 ......
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 ......
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] ``` ......
Linux下find的使用
* 返回文件的位置 `find -name '文件名'` * 返回符合条件的文件个数 `find -name '文件名' | wc -l` * 删除当前路径下所有符合条件的文件或目录 `find . -name "*.py" | xargs rm -rf` `find . -name "目录名" | ......
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 ......
flutter String 字符串常用的方法
连接字符串: String test='hello'; String c_test='world'; c_test='${test} ${c_test}!'// hello world! //检查c_test 是否以 !结尾 bool b=c_test.endsWith('!')// b=true ......
[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 ......
string函数
这篇文章介绍一些String类常用函数。 1、转换小写 string s = "ChinaPeople";string s1 = s.ToLower(); //字符串是不可变的,所以转换后的值通过字符串返回Console.WriteLine(s1);//输出:chinapeole2、转化为大写 st ......
leetcode2130反转链表
1尾插法:记录前面的节点,使后面的节点指向前面的节点;记后面的节点为now。因为要不停移动now,使其移动所以要临时记录原来之后的节点。 ListNode* now=slow->next; ListNode* pre=nullptr; while(now){ ListNode* node=now-> ......
8-102-(LeetCode- 207&210) 课程表II
1. 题目 读题 210. 课程表 II 考查点 2. 解法 思路 这道题的解答思路是使用拓扑排序来判断有向图是否有环,如果有环,说明无法完成所有课程,如果没有环,输出拓扑排序的结果。拓扑排序的基本思想是从有向图中选择一个没有前驱(即入度为0)的顶点并输出,然后从图中删除该顶点和所有以它为起点的有向 ......
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 ......
LeetCode 热题 100 之 15. 三数之和
# 题目描述 给你一个整数数组 nums ,判断是否存在三元组 [nums[i], nums[j], nums[k]] 满足 i != j、i != k 且 j != k ,同时还满足 nums[i] + nums[j] + nums[k] == 0 。请 你返回所有和为 0 且不重复的三元组。 注 ......
LeetCode 热题 100 之 11. 盛最多水的容器
# 题目描述 给定一个长度为 n 的整数数组 height 。有 n 条垂线,第 i 条线的两个端点是 (i, 0) 和 (i, height[i]) 。 找出其中的两条线,使得它们与 x 轴共同构成的容器可以容纳最多的水。 返回容器可以储存的最大水量。 说明:你不能倾斜容器。 示例 1: ![im ......
LeetCode 793. Preimage Size of Factorial Zeroes Function 二分
Let `f(x)` be the number of zeroes at the end of x!. Recall that $x! = 1 * 2 * 3 * ... * x$ and by convention, 0! = 1. For example,` f(3) = 0` because ......
LeetCode 周赛上分之旅 #33 摩尔投票派上用场
> ⭐️ **本文已收录到 [AndroidFamily](https://github.com/pengxurui/AndroidFamily),技术和职场问题,请关注公众号 [彭旭锐] 和 [BaguTree Pro] 知识星球提问。** > > 学习数据结构与算法的关键在于掌握问题背后的算法思 ......
VSCode - go error: gopls was not able to find modules in your workspace
gopls was not able to find modules in your workspace. When outside of GOPATH, gopls needs to know which modules you are working on. You can fix this b ......
编写一个函数,判断 string 对象中是否含有大写字母。编写另-个函数,把 string 对象全都改成小写形式。在这两个函数中你使用的形参类型相同吗?为什么?
第一个函数的任务是判断 string 对象中是否含有大写字母,无须修改参数的内容,因此将其设为常量引用类型。第二个函数需要修改参数的内容,所以应该将其设定为非常量引用类型。满足题意的程序如下所示: #include <iostream> #include <Windows.h> using name ......
leetcode day4 24 19 面试题02.07 142
[toc] #24. 两两交换链表中的节点 ![](https://img2023.cnblogs.com/blog/3239608/202307/3239608-20230715224335895-687431293.png) ![](https://img2023.cnblogs.com/blo ......