1
class WordFilter:
2
def __init__(self, words: List[str]):
3
self.words = words
4

5
def f(self, prefix: str, suffix: str) -> int:
6
idx = -1
7
for i, w in enumerate(self.words):
8
if w.startswith(prefix) and w.endswith(suffix):
9
idx = i
10

11
return idx

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0