程家斌
程家斌
全部文章
分类
归档
标签
去牛客网
登录
/
注册
程家斌的博客
全部文章
(共53篇)
题解 | 买卖股票的最好时机(二)
#include <iostream> #include <vector> using namespace std; int main() { // 定义一个变量 n,用于存储数组的长度(元素个数) int n; // 从标准输入读取一个整数,赋值...
2025-07-17
0
34
题解 | 买卖股票的最好时机(一)
class Solution { public: int maxProfit(vector<int>& prices) { // 初始时,把第 0 天的价格当作当前认为的买入价格(后续会动态更新) int current_end...
2025-07-17
0
49
题解 | 倒置字符串
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { vector<...
2025-07-17
0
44
题解 | 扑克牌顺子
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param numbers int整型vector * @return bool布尔型...
2025-07-12
0
31
题解 | 添加逗号
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { int n; cin >> n; s...
2025-07-12
0
40
题解 | 跳台阶
// 动态规划的思路 class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param number int整型 * @return int整...
2025-07-12
0
33
题解 | 字母收集
#include <iostream> #include <vector> using namespace std; int GetScore(char c) { if(c == 'l') return 4; else if(c == 'o') return...
2025-07-12
0
26
题解 | 数组中的最长连续子序列
#include <iostream> #include <unordered_set> #include <vector> using namespace std; int main() { int n; cin >> n; ...
2025-07-12
0
36
题解 | 求最小公倍数
#include <iostream> using namespace std; int main() { int a, b; cin >> a >> b; int n = a, m = b; while(m != 0) ...
2025-07-12
0
38
题解 | 字符串中找出连续最长的数字串
#include <iostream> #include <string> #include <algorithm> using namespace std; int main() { string str; cin >> str...
2025-07-09
1
52
首页
上一页
1
2
3
4
5
6
下一页
末页