S2
S2 copied to clipboard
0219. Contains Duplicate I I | LeetCode Cookbook
https://books.halfrost.com/leetcode/ChapterFour/0200~0299/0219.Contains-Duplicate-II/
保证map的大小恒定这一个想法很赞
这种思路很好,避免了频繁的计算index的差值,效率快狠毒
厉害!提一个小问题:record的length其实可以初始为 k+1
对吧,因为只需要保证可以检测到额外一个数值即可吧。感谢!
厉害!提一个小问题:record的length其实可以初始为
k+1
对吧,因为只需要保证可以检测到额外一个数值即可吧。感谢!
@delongGao 嗯。可以的。