kamyu104 / LeetCode-Solutions

🏋️ Python / Modern C++ Solutions of All 3343 LeetCode Problems (Weekly Update)
MIT License
4.72k stars 1.56k forks source link

Shouldn't this be p[0] -= times? #150

Closed GUOWEICAIUS closed 2 years ago

GUOWEICAIUS commented 2 years ago

https://github.com/kamyu104/LeetCode-Solutions/blob/5ef49a494bcf7ee966f03a647dfb75a39900df9e/Python/design-search-autocomplete-system.py#L29

kamyu104 commented 2 years ago

No, times is the latest value instead of delta value.

GUOWEICAIUS commented 2 years ago

Thanks. That's correct because we are recording the time of s, not the prefix to the current Trie node (which would be accumulated value then).