程家斌
程家斌
全部文章
分类
归档
标签
去牛客网
登录
/
注册
程家斌的博客
全部文章
(共53篇)
题解 | 删除相邻数字的最大分数
#include <vector> #include <algorithm> class Solution { public: int boredom(vector<int>& a) { // 边界处理:空数组直接返回0 ...
2025-07-21
0
43
题解 | 最长无重复子数组
class Solution { bool vis[100010] = {false}; // 标记数组,记录元素是否在当前窗口中出现过 public: int maxLength(vector<int>& arr) { int lef...
2025-07-20
0
42
题解 | [NOIP2002 普及组] 过河卒
#include <iostream> using namespace std; long long dp[26][26]; int main() { int n, m, x, y; cin >> n >> m >> x >...
2025-07-20
0
27
题解 | 最长回文子串
// 枚举所有的中⼼点,然后向两边扩散 class Solution { public: int getLongestPalindrome(string A) { int ret = 1; // 如果字符串长度为奇数 for(int...
2025-07-20
0
28
题解 | 跳台阶
class Solution { public: int jumpFloor(int number) { int a = 1, b = 1, c; for(int i = 2; i <= number; i++) { ...
2025-07-20
0
34
题解 | 添加逗号
#include <iostream> #include <string> using namespace std; int main() { string str; cin >> str; int n = str.size(); ...
2025-07-20
0
23
题解 | 求最小公倍数
#include <iostream> using namespace std; int gcd(int a, int b) { if(b == 0) return a; return gcd(b, a % b); } int main() { int a,...
2025-07-20
0
33
题解 | 最长无重复子数组
class Solution { public: int maxLength(vector<int>& arr) { unordered_map<int, int> hash; int max_len = 1; ...
2025-07-17
0
26
题解 | 删除公共字符
#include <iostream> #include <string> #include <unordered_set> using namespace std; int main() { string str1, str2; getlin...
2025-07-17
0
37
题解 | 两个链表的第一个公共结点
/* struct ListNode { int val; struct ListNode *next; ListNode(int x) : val(x), next(NULL) { } };*/ class Solution { public: ListNode* Find...
2025-07-17
0
39
首页
上一页
1
2
3
4
5
6
下一页
末页