5.7

今日
1.算法
leetcode每日一题跳跃游戏 IX

class Solution {
public:
    vector<int> maxValue(vector<int>& nums) {
        const int n = nums.size();
        vector<int> ans, leftmax;
        for(int i = 0, lm = 0; i != n; ++i){
            lm = max(lm, nums[i]);
            leftmax.push_back(lm);
        }
        ans = leftmax;
        for(int i = n - 2, rightmin = nums[n - 1]; i >= 0; --i){
            if(leftmax[i] > rightmin) ans[i] = ans[i + 1];
            rightmin = min(rightmin, nums[i]);
        }
        return ans;
    }
};

2.健身房健身(肩)
3.休闲娱乐

posted @ 2026-05-07 21:14  douzishuo  阅读(11)  评论(0)    收藏  举报