leetcode位置0830
leetcode第109场双周赛
[题目传送门](https://leetcode.cn/contest/biweekly-contest-109/) # [6931. 访问数组中的位置使分数最大](https://leetcode.cn/problems/visit-array-positions-to-maximize-scor ......
LeetCode 438. Find All Anagrams in a String 滑动窗口
Given two strings `s` and `p`, return an array of all the start indices of `p`'s anagrams in s. You may return the answer in any order. An Anagram is ......
leetcode第 109 场双周赛
## [6930. 检查数组是否是好的 - 力扣(LeetCode)](https://leetcode.cn/problems/check-if-array-is-good/) **首先判断数组长度是不是最大值 + 1, 然后排个序,判断0到n - 2是不是都是1到最大值的一个排列,满足这些返回t ......
【优先队列】【堆排序实现优先队列】[1054. 距离相等的条形码](https://leetcode.cn/problems/distant-barcodes/)
#### 【优先队列】【堆排序实现优先队列】[1054. 距离相等的条形码](https://leetcode.cn/problems/distant-barcodes/) 在一个仓库里,有一排条形码,其中第 i 个条形码为 barcodes[i]。 请你重新排列这些条形码,使其中任意两个相邻的条形 ......
[LeetCode] 894. All Possible Full Binary Trees
Given an integer n, return a list of all possible full binary trees with n nodes. Each node of each tree in the answer must have Node.val == 0. Each e ......
LeetCode 3. Longest Substring Without Repeating Characters 滑动窗口
Given a string `s`, find the length of the longest substring without repeating characters. ## Solution 用一个 $dict$ 来映射字符的次数。然后用 $left$, $right$ 来决定wind ......
2-5 编写函数 any(s1, s2),将字符串 s2 中的任一字符在字符串 s1 中第一次 出现的位置作为结果返回。如果 s1 中不包含 s2 中的字符,则返回-1
# 稍作修改,不返回任意字符...位置,直接输出所有符合条件...位置 Archlinux GCC 13.1.1 20230429 2023-07-22 22:59:55 星期六 点击查看代码 ``` #include void any(char s1[], char s2[]) { int i, ......
leetcode-2582-easy
Pass the Pillow ``` There are n people standing in a line labeled from 1 to n. The first person in the line is holding a pillow initially. Every secon ......
Leetcode394. 字符串解码
``` class Solution { public: string dfs(string s,int &idx) { string str; while(idx'0'&&s[idx]='0'&&s[idx]<='9') num+=s[idx++]; if(s[idx]=='[') { int c ......
leetcode 栈与队列 232 225
[toc] #基本介绍 栈,先进后出 队列,先进先出 ##四个问题 1. C++中stack 是容器么? 2. 我们使用的stack是属于哪个版本的STL? 3. 我们使用的STL中stack是如何实现的? 4. stack 提供迭代器来遍历stack空间么? 首先大家要知道 栈和队列是STL(C+ ......
[LeetCode] 1349. Maximum Students Taking Exam 参加考试的最大学生数
Given a `m * n` matrix `seats` that represent seats distributions in a classroom. If a seat is broken, it is denoted by `'#'` character otherwise it i ......
codility 和 leetcode 对比
根据网上的信息,codility 和 leetcode 都是用于评估编程技能的在线平台,它们都提供了不同难度和类型的编程挑战,支持多种编程语言,并可以用于招聘和面试的过程中。 不过,它们也有一些区别,比如: codility 更专注于工程团队的技能评估,它提供了 CodeCheck, CodeLiv ......
leetcode872叶相似树
这道题是考虑的深度优先搜索,使用递归 vecotr和queue入队操作并不相同: vector只能使用push_back(); queue既可以使用push()还可以使用push_back() void FindLeaf(TreeNode* root,vector<int>& v){ if(!roo ......
LeetCode 347. 前 K 个高频元素
# 快排思想 - 注意,这里是倒序排序,因此应该`while(nums[i].cnt>x);` ``` class Solution { public: struct element { int val,cnt; element(int a,int b) { val=a; cnt=b; } }; v ......
LeetCode -- 773. 滑动谜题
启发式搜索 class Solution { struct Node { string str; int x, y; int val; }; int n = 2, m = 3; string e = "123450"; int dx[4] = {-1, 0, 1, 0}; int dy[4] = { ......
[LeetCode] 2297. Jump Game VIII
You are given a 0-indexed integer array nums of length n. You are initially standing at index 0. You can jump from index i to index j where i < j if: ......
leetcode 28 459 总结 KMP算法
[toc] #28 ##解法一,暴力法 ``` //暴力 if(haystack.length() pi(m); for (int i = 1, j = 0; i 0 && needle[i] != needle[j]) { j = pi[j - 1]; } if (needle[i] == nee ......
[LeetCode] 2408. Design SQL
You are given n tables represented with two arrays names and columns, where names[i] is the name of the ith table and columns[i] is the number of colu ......
如何修改NuGet默认全局包文件夹的位置?
由于一些历史原因,重装系统成为Windows用户解决疑难杂症的祖传手艺。受此影响,给硬盘分区几乎成为了一种执念,少则C、D两个盘,夸张一点的5~6个盘的也不是没有。 > PS:macOS和Linux一直都不鼓励给磁盘分区,虽然不禁止但也不提倡。随着云技术和宽带的提升,越来越多的人更喜欢把自己认为比较 ......
如何修改NuGet默认全局包文件夹的位置?
由于一些历史原因,重装系统成为Windows用户解决疑难杂症的祖传手艺。受此影响,给硬盘分盘几乎成为了一种执念,少则C、D两个盘,夸张一点的5~6个盘的也不是没有。 > PS:macOS和Linux一直都不鼓励给磁盘分区,虽然不禁止但也不提倡。随着云技术和宽带的提升,越来越多的人更喜欢把自己认为比较 ......
C++Const变量的存储位置
## const变量/对象的存储位置 ### const局部变量 const局部基础变量和自定义变量都存储在栈上 ~~~c struct diy_class{ int a; int b; diy_class(int a, int b ) : a(a), b(b){ } }; int main() { ......
leetcode-1518-easy
Water Bottles ``` There are numBottles water bottles that are initially full of water. You can exchange numExchange empty water bottles from the marke ......
通过经纬度使用高德api获取具体位置
package com.gofun.api.utils; import java.io.BufferedReader; import java.io.InputStreamReader; import java.net.HttpURLConnection; import java.net.URL; ......
Codility / LeetCode的重要性与注意事项
Codility / Leetcode 不只会针对回答内容给出最终分数,也会一并记录解题的过程供面试官参考; 相较于现场考试,Codility / Leetcode可以省下更多时间,也能让求职者在最熟悉的环境发挥实力。 进行测验前 先查看Codility / Leetcode FAQ,并完成demo ......
[LeetCode] 2268. Minimum Number of Keypresses
You have a keypad with 9 buttons, numbered from 1 to 9, each mapped to lowercase English letters. You can choose which characters each button is match ......
[LeetCode] 2323. Find Minimum Time to Finish All Jobs II
You are given two 0-indexed integer arrays jobs and workers of equal length, where jobs[i] is the amount of time needed to complete the ith job, and w ......
[LeetCode] 2330. Valid Palindrome IV
You are given a 0-indexed string s consisting of only lowercase English letters. In one operation, you can change any character of s to any other char ......
[LeetCode] 2340. Minimum Adjacent Swaps to Make a Valid Array
You are given a 0-indexed integer array nums. Swaps of adjacent elements are able to be performed on nums. A valid array meets the following condition ......
[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 ......