精華區beta Marginalman 關於我們 聯絡資訊
在下覺得今天不是個練習KMP的好日子 下次吧 一輩子學不會KMP 至於那個rolling hash 我們祝他幸福 def countPrefixSuffixPairs(self, words: List[str]) -> int: ans = 0 for i in range(len(words)): for j in range(i+1, len(words)): if len(words[i])<=len(words[j]) and words[i]==words[j][:len(words[i])] and words[i]==words[j][-len(words[i]):]: ans += 1 return ans -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 125.229.37.69 (臺灣) ※ 文章網址: https://www.ptt.cc/bbs/Marginalman/M.1736345152.A.1DC.html
Sougou: 內卷王者 01/08 22:06
sustainer123: 剩我寫得跟狗啃一樣 恨恨恨 01/08 22:07