lao1 me
AI服务器日常推广公告
搜索
菜单
主题回帖收藏
  • SomeBottle
    Leetcode每日一题 —— 3863. 将一个字符串排序的最小操作次数
    分类讨论。比较暴力``` class Solution { public: int minOperations(string s) { auto t = s; sort(t.begin(),t.end()); if(s == t) { return 0; } int n = s.size(); auto minv = t[0]; auto maxv = t[n - 1]; if(minv == s
    SomeBottle4天前AI3tiansuohaoer
    AI
  • 魔法师
    Leetcode每日一题 —— 3727. 最大交替平方和
    贪心``` class Solution { public: long long maxAlternatingSum(vector<int>& nums) { sort(nums.begin(),nums.end(),[](const int& a, const int &b) -> bool { return abs(a) < abs(b); }); long long res = 0; int
    魔法师2026-10-13AI70wFF
    AI
  • SomeBottle
    Leetcode每日一题 —— 856. 括号的分数
    看到括号依旧喜欢递归,依旧把自己递归晕掉写半天。``` class Solution { public: int scoreOfParentheses(string s) { int n = s.size(); int idx = 0; auto solve = [&](this auto&& solve) -> int { if(idx >= n) { return 0; } if(s[idx]
    SomeBottle2026-10-05AI2tiansuohaoer
    AI
  • SomeBottle
    Leetcode每日一题 —— 678. 有效的括号字符串
    两趟``` class Solution { public: bool checkValidString(string s) { int buffer_count = 0,diff = 0; int n = s.size(); for(int i = 0; i < n; i++) { if(s[i] == '*') { buffer_count++; } else if(s[i] == '(')
    SomeBottle2026-10-04AI3咪帕
    AI
Lvvvv
Lvvvv
Lv1 · lao1 0
TA的主题TA的回帖我的称号TA的收藏
提示