Approach 1: Classic sliding window
- Time:O(|\texttt{s1}| + |\texttt{s2}|)
- Space:O(128) = O(1)
C++ |
---|
|
JAVA |
---|
|
Approach 2: Constant-sized moving window
- Time:O(|\texttt{s1}| + |\texttt{s2}|)
- Space:O(128) = O(1)
C++ |
---|
|
JAVA |
---|
|
Python |
---|
|