LeetCode --- 1566. Detect Pattern of Length M Repeated K or More Times 解题报告
Posted 杨鑫newlfe
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了LeetCode --- 1566. Detect Pattern of Length M Repeated K or More Times 解题报告相关的知识,希望对你有一定的参考价值。
Given an array of positive integers arr
, find a pattern of length m
that is repeated k
or more times.
A pattern is a subarray (consecutive sub-sequence) that consists of one or more values, repeated multiple times consecutively without overlapping. A pattern is defined by its length and the number of repetitions.
Return true
if there exists a pattern of length m
that is repeated k
or more times, otherwise return false
.
Example 1:
Input: arr = [1,2,4,4,4,4], m = 1, k = 3 Output: true Explanation: The pattern (4) of length 1 is repeated 4 consecutive times. Notice that pattern can be repeated k or more times but not less.
Example 2:
Input: arr
以上是关于LeetCode --- 1566. Detect Pattern of Length M Repeated K or More Times 解题报告的主要内容,如果未能解决你的问题,请参考以下文章