Re: [閒聊] 每日leetcode

看板Marginalman作者 (神楽めあ的錢包)時間1月前 (2025/11/01 02:08), 編輯推噓0(001)
留言1則, 1人參與, 1月前最新討論串1542/1548 (看更多)
※ 引述《sixB (6B)》之銘言: : 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; : } : }; 這題就想成爬樓梯 統計你總共上了幾層階梯 就突然變成easy了 這就是leetcode題目的神奇地方 題目敘述永遠是最難懂的 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 203.121.235.241 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1761934107.A.0BB.html

11/01 15:14, 1月前 , 1F
對 我當成爬山再寫 超神奇
11/01 15:14, 1F
文章代碼(AID): #1f1FiR2x (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1f1FiR2x (Marginalman)