2093. Check If String Is a Prefix of Array
My accepted Python solution to LeetCode problem 2093, Check If String Is a Prefix of Array, running in 0ms.
- Difficulty: Easy
- Python
- Runtime 0ms
- Memory 17.3MB
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
Python
Accepted on LeetCode — runtime 0ms, memory 17.3MB, accepted 2025-12-30.
class Solution:
def isPrefixString(self, s: str, words: List[str]) -> bool:
concat = ""
for word in words:
concat += word
if concat == s:
return True
if len(concat) > len(s):
return False
return False