Back to course home
0% completed
Vote For New Content
Space complexity is wrong -> O(1)
shanehowe100
Aug 30, 2024
As mentioned in one of the constraints
strandpatconsist of lowercase English letters
This means when building our hashmap from pat in the worst case it will grow to O(26) . This is a constant number and can be simplified to O(1)
1
0
Comments
Comments
Felix Pherrya year ago
agreed. it can only grow to O(26). I'd also argue that the time complexity is just O(N). We don't really care bout the m since we know that M <= N anyways. It's like we simplify O(2N) to O(N) in this case.
On this page