Re: [閒聊] 每日leetcode
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;
}
};
--
很姆的咪
姆之咪
http://i.imgur.com/5sw7QOj.jpg

--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.135.99.218 (臺灣)
※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1761930975.A.0CB.html
討論串 (同標題文章)
完整討論串 (本文為第 1541 之 1548 篇):