@@ -28,10 +28,10 @@ There is one slight problem, python's implementation of string concatention is a
28
28
When the question wants the actual substring and not a count, even using a deque will not solve this problem.
29
29
So this implementation is technically ** O(S * (S+T))** due to python.
30
30
31
- When implementing these type of two pointer questions.
32
- I recommend to ** avoid using indexes as much as possible and use iterators** .
31
+ We could use indexes instead of string slices, however, the code gets complex.
32
+ When implementing these type of two pointer questions, I recommend to ** avoid using indexes as much as possible and use iterators** .
33
33
It is very easy to get a one off error doing these and within a 30 minute timeframe, it is very risky.
34
- Just talk about using indexes instead and you will be fine .
34
+ Just talk about how to refactor with indexes .
35
35
36
36
```
37
37
from collections import defaultdict
@@ -75,7 +75,7 @@ We can still use a dictionary to count the occurances, but we can also keep a se
75
75
This will represent the number of unique valid characters of T.
76
76
77
77
If T = 'abcc', then there are 3 keys in the dictionary.
78
- When ever we increment a key in the dictionary, we can then compare the dictionary T's count with dictionary S's count.
78
+ Whenever we increment a key in the dictionary, we can then compare the dictionary T's count with dictionary S's count.
79
79
If S's count equals exactly what T's count is, then we just got one of the 3 keys validated.
80
80
If we decrement, and S's count is T's count-1, then we just unvalidated one of those keys.
81
81
0 commit comments