1080. Camelcase Matching
My accepted Python solution to LeetCode problem 1080, Camelcase Matching, running in 0ms.
- Difficulty: Medium
- Python
- Runtime 0ms
- Memory 17.2MB
- 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.2MB, accepted 2026-01-02.
class Solution:
def camelMatch(self, queries: List[str], pattern: str) -> List[bool]:
def matches(query, pattern):
i = 0 # pattern index
for c in query:
if i < len(pattern) and c == pattern[i]:
i += 1
elif c.isupper():
return False
return i == len(pattern)
return [matches(q, pattern) for q in queries]