You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: leetcode/hard/076_minimum_window_substring.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,6 +19,8 @@ Then we have to keep a dynamic counter, decrementing and incrementing character
19
19
With this, after we moved the right pointer to the right, we can use these two dictionaries to check if this is a substring that meets the requirements.
20
20
If so, we can then try pruning with the left pointer all the way to the right pointer or if it doesn't meet the requirement.
21
21
22
+
For the run-time, worst case, we will be visiting each character twice.
23
+
22
24
You may think that the run-time for this is exponential, especially when we are checking the two dictionaries.
23
25
However, don't be mistaken, the comparison is actually a constant T run-time, it doesn't change based on S, but rather on T.
24
26
There is one slight problem, python's implementation of string concatention is actually **O(N)**.
0 commit comments