Grokking Meta Coding Interview
Ask Author
Back to course home

0% completed

Vote For New Content
Nishith Iyer
Great question, but isn't the space complexity O(S + T)?

Nishith Iyer

May 5, 2024

In the code we can see that, the map stores frequency of every character in string 's' while expanding the sliding window regardless of whether it is available in the string 't' or not. In cases where character occurrence isn't found in 't' the count will get negative.

We are putting characters from both strings 's' & 't' into the hash map wherein the former gets populated during window expansion and the latter gets populated early on at the start during initialisation.

Am I missing something here?

0

0

Comments
Comments

On this page