Re: [閒聊] 每日leetcode

看板Marginalman作者 (是oin的說)時間11月前 (2025/01/09 15:44), 編輯推噓1(100)
留言1則, 1人參與, 11月前最新討論串1256/1554 (看更多)
題目 有幾個字串的前綴是目標字串 思路 用substr看 py還有一行解 超姆咪 ```cpp class Solution { public: int prefixCount(vector<string>& words, string pref) { int n = pref.size(); int res = 0; for(string k : words) { if(k.substr(0,n) == pref)res++; } return res; } }; ``` -- 邊版的小母雞 — fuckchicken https://i.imgur.com/wglAuYR.jpg
https://i.imgur.com/jrYHfaa.jpeg
-- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.228.169.39 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1736408663.A.728.html

01/09 16:43, 11月前 , 1F
剩我暴力解
01/09 16:43, 1F
文章代碼(AID): #1dVtvNSe (Marginalman)
討論串 (同標題文章)
文章代碼(AID): #1dVtvNSe (Marginalman)