看板 Marginalman 關於我們 聯絡資訊
※ 引述《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
sixB: 對 我當成爬山再寫 超神奇 11/01 15:14