菜菜子不想再菜了
菜菜子不想再菜了
全部文章
分类
归档
标签
去牛客网
登录
/
注册
菜菜子不想再菜了的博客
全部文章
(共84篇)
题解 | #判断是否为回文字符串#
class Solution { public: /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param str string字符串 待判断的字符串 * @return bool布尔...
2024-07-24
0
112
题解 | #大数加法#
static const auto io_sync_off = []() { //lambda函数 // turn off sync,关闭输入输出流的缓存 std::ios::sync_with_stdio(false); // untie in/out streams,实现...
2024-07-23
0
141
题解 | #验证IP地址#
class Solution { public: bool validIPv4(string& s, int be, int en) { //判断一个组是否符合IPv4 if (en - be > 3 || en <= be) return false...
2024-07-23
0
146
题解 | #最长公共前缀#
#include <algorithm> class Solution { public: string longestCommonPrefix(vector<string>& strs) { if(strs.empty()) return...
2024-07-22
0
140
题解 | #字符串变形#
static const auto io_sync_off = []() { //定义一个静态匿名函数,程序运行时自动执行,优化输入输出效率 std::ios::sync_with_stdio(false);//关闭输入输出 std::cin.tie(nullptr);//取消两个s...
2024-07-22
0
163
题解 | #字符串变形#
class Solution { public: string trans(string s, int n) { string tmp = "", res = ""; for (int i = 0; i < n...
2024-07-22
0
131
题解 | #打家劫舍(二)#
class Solution { public: int rob(vector<int>& nums) { int len = nums.size(); vector<int> dp(len + 3, 0); //dp[i]...
2024-07-21
0
152
题解 | #打家劫舍(一)#
#include <vector> class Solution { public: int rob(vector<int>& nums) { int len = nums.size(); if (len == 1) ret...
2024-07-21
0
111
题解 | #编辑距离(一)#
想复杂了,也想简单了。想复杂在于一开始没想到有这样一个动态规则,就想着字符串匹配那一套了;想简单在于只想着第一个字符串合起来去匹配,没想到“abba”“abxba”这类情况。 #include <vector> class Solution { public: int edi...
2024-07-17
0
155
题解 | #数字字符串转化成IP地址#
#include <vector> class Solution { public: bool isValid(const string& s) { if (s.empty() || s.length() > 3 || (s.length() &...
2024-07-16
0
136
首页
上一页
1
2
3
4
5
6
7
8
9
下一页
末页