Solution 1 hash map

  • t-complexity: $O(n)$

  • s-complexity: $O(n)$

用hash存放出现的字符串。最后扫描一遍hash表

Last updated