LeetCode solutions

1080. Camelcase Matching

My accepted Python solution to LeetCode problem 1080, Camelcase Matching, running in 0ms.

  • Difficulty: Medium
  • Python
  • Runtime 0ms
  • Memory 17.2MB

Read the problem on LeetCode View on GitHub

Python

Accepted on LeetCode — runtime 0ms, memory 17.2MB, accepted 2026-01-02.

python
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]

Source