Re: [閒聊] 每日leetcode已回收

看板Marginalman作者 (是oin的說)時間1年前 (2024/07/10 10:34), 編輯推噓2(201)
留言3則, 3人參與, 1年前最新討論串469/1554 (看更多)
https://leetcode.com/problems/crawler-log-folder :   : 1598. Crawler Log Folder :   : 有一log紀錄使用者更改資料夾的操作 :   : 操作有三: :   : 1 ../:回到父資料夾 假如已在主資料夾 則不變 :   : 2 ./:不變 :   : 3 x/:前往子資料夾x :   :   : 請回傳完成log的資料夾操作後 回到主資料夾的最小操作 :   思路: 好想跟靈夢做愛喔 ```cpp class Solution { public: int minOperations(vector<string>& logs) { int len = logs.size(); int n = 0; for(int i = 0 ; i < len ; i ++) { if(logs[i] == "../") { if(n>0)n --; } else if(logs[i] == "./" )continue; else n++; } return n; } }; ``` 記錄一下 我感覺我這個寒假要拿徽章了 不要不信 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.230.133.184 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1720578881.A.71B.html

07/10 10:34, 1年前 , 1F
暑假 講錯
07/10 10:34, 1F

07/10 10:38, 1年前 , 2F
大師
07/10 10:38, 2F

07/10 10:40, 1年前 , 3F
大師
07/10 10:40, 3F
文章代碼(AID): #1cZVD1SR (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1cZVD1SR (Marginalman)