[問題]算法 k distinct letters
https://imgur.com/a/2GAU3
my solution
https://repl.it/@shih_hsuanhsu/KDistinctCharacter
def KDistinctCharacter3
def KDistinctCharacter2
兩個方法應該都正確,但是複雜度為O(nk)
網路上高手說可以做到O(n)
我試著又寫了 KDistinctCharacter
但是我想不透該怎麼做
求助!
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 172.89.32.145
※ 文章網址: https://www.ptt.cc/bbs/Python/M.1520896240.A.EE7.html
→
03/13 10:00,
7年前
, 1F
03/13 10:00, 1F
推
03/19 13:39,
7年前
, 2F
03/19 13:39, 2F
→
03/19 13:40,
7年前
, 3F
03/19 13:40, 3F
討論串 (同標題文章)
以下文章回應了本文:
完整討論串 (本文為第 1 之 2 篇):
Python 近期熱門文章
PTT數位生活區 即時熱門文章