290-Word-Pattern

Sat 17 May 2025

https://leetcode.com/problems/word-pattern

import pyutil as pyu
pyu.get_local_pyinfo()
print(pyu.ps2("python-dotenv"))
from typing import List
class Solution:
  def wordPattern(self, pattern: str, str: str) -> bool:
    t = str.split()
    return [*map(pattern.index, pattern)] == [*map(t.index, t)]
new Solution().wordPattern()

Score: 5

Category: leetcode