1967. Number of Strings That Appear as Substrings in Word
Brute force: iterate over patterns
and check if pattern[i]
is a substring of word
.
Code:
Python3
Big O Analysis
-
Runtime
The runtime complexity here is where N = length of list p.
-
Memory
The memory usage is
O(N)
since we use aret
string.
— A