用心的布莱克刷牛客
用心的布莱克刷牛客
全部文章
分类
归档
标签
去牛客网
登录
/
注册
用心的布莱克刷牛客的博客
全部文章
(共27篇)
题解 | 字符串排序
#include <iostream> #include<algorithm> using namespace std; //字符串s中有空格,我们使用getline来读取 //先遍历字符串将其中的字母字符存下来,对其进行排序(不区分大小写需要自定义规则) //遍历原字符串,...
2025-06-09
0
19
题解 | 数据分类处理
#include <iostream> #include<string> #include<set> #include<vector> using namespace std; //用一个set<string>来存储规则集r(自动排序去重)...
2025-05-22
0
28
题解 | 最长递增子序列
#include <algorithm> class AscentSequence { public: int findLongest(vector<int> A, int n) { // write code here //原版LIS...
2025-05-21
0
28
题解 | 合唱队
#include <iostream> #include<vector> using namespace std; //遍历每一位同学作为中心位置,对中心的左边部分求LIS,对右边部分求最长递减子序列,将两部分长度相加求和,最后我们取所有和中的最大值即可 //LIS问题:1,...
2025-05-21
0
39
题解 | 在字符串中找出连续最长的数字串
#include <iostream> #include<vector> using namespace std; //按照正常逻辑来做就可以,用一个二维数组容器存储所有的数字子串 //依次处理每个字符,如果是数字则push到容器中,然后cnt+1 //如果重新遇到字母,则上...
2025-05-21
0
40
题解 | 查找两个字符串a,b中的最长公共子串
#include <iostream> #include<vector> using namespace std; //动态规划,dp[i][j]代表以s[i-1]和t[j-1]结尾的最长公共子串 //状态转移:如果s[i-1]==t[j-1],则dp[i][j]=dp[i-...
2025-05-20
0
29
题解 | 查找两个字符串a,b中的最长公共子串
#include <iostream> #include<vector> using namespace std; //动态规划,dp[i][j]代表以s[i-1]和t[j-1]结尾的最长公共子串 //状态转移:如果s[i-1]==t[j-1],则dp[i][j]=dp[i-...
2025-05-20
0
26
题解 | 万万没想到之聪明的编辑
#include <bits/stdc++.h> using namespace std; // 双指针的解法:i,j指针都从头开始依次递增,但当j超过三或四的时候,就需要对j的前三位或前四位进行判断了。 //2,如果前三位或者前四位符合了AAA或者AABB的形式,说明新插入的元素(A或...
2025-05-20
0
23
题解 | 万万没想到之聪明的编辑
#include <iostream> #include<string> #include<deque> using namespace std; int main() { //使用一个长度为四的滑动窗口来处理即可(用双向队列来实现) //如果窗...
2025-05-20
0
27
题解 | 最小编辑代价
class MinCost { public: int findMinCost(string A, int n, string B, int m, int c0, int c1, int c2) { //原版的编辑代价的基础上每个操作加入的权重,修改一下状态转移方程即可 ...
2025-05-20
0
24
首页
上一页
1
2
3
下一页
末页