2020 第 36 周 LeetCode 记录

Yiran at 
1566. Detect Pattern of Length M Repeated K or More Times 链接到标题 判断数组中是否存在连续长度为 m 且重复次数为 k 的字符串,直接对 arr 进行切片判断。class Solution: def containsPattern(self, arr: List[int], m: int, k: int) -> bool: i = 0 while i < len(arr): p = arr[i:i+m] if p * k == arr[i:i+m*k]: return True i += 1 return False 1567. Ma……