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

看板Marginalman作者時間1年前 (2024/05/21 09:40), 編輯推噓2(200)
留言2則, 2人參與, 1年前最新討論串251/1554 (看更多)
78. Subsets 基本上跟昨天一樣 不過這次試著寫一個非遞迴的 class Solution { public: vector<vector<int>> subsets(vector<int>& nums) { vector<vector<int>> ans; ans.push_back(vector<int>()); for(int n : nums){ int len = ans.size(); for(int i = 0; i < len; i++){ vector<int> v = ans[i]; v.push_back(n); ans.push_back(v); } } return ans; } }; -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 114.36.46.164 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1716255642.A.02D.html

05/21 09:41, 1年前 , 1F
別卷了
05/21 09:41, 1F

05/21 10:28, 1年前 , 2F
別捲了
05/21 10:28, 2F
文章代碼(AID): #1cI_kQ0j (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1cI_kQ0j (Marginalman)