Re: [闲聊] 每日leetcode

楼主: sixB (6B)   2025-11-01 01:16:12
1562.
看到今天是ez不想写
然后发现昨天的是hard
阿不是啊
hard 5行喔?
谁订的 真的吗0.0
class Solution {
public:
int minNumberOperations(vector<int>& target) {
int res = 0, last = 0;
for(int i: target){
res += max(0, i - last);
last = i;
}
return res;
}
};

Links booklink

Contact Us: admin [ a t ] ucptt.com