Analysis:
If we use the string sequence as the hash map’s key, then the space limitation will be exceeded. Therefore we should use the bit to represent the genome elements and the bit mask as well.
Time Complexity:
- O(n)
Space Complexity:
- O(n)
Code
1 | class Solution(object): |