Tap here to switch tabs
Problem
Submissions

Problem: Detect Pattern of Length M Repeated K or More Times

med
30 min
Try to solve the Detect Pattern of Length M Repeated K or More Times problem.

Statement

Given an array of positive integers arr, determine if there is a contiguous subarray of length m that repeats kk or more consecutive times.

A pattern is a sequence of consecutive elements. A repetition of this pattern consists of the exact same sequence appearing at least kk times back to back without interruption.

Return true if any such pattern exists, and false otherwise.

Constraints:

  • 2≤2 \leq arr.length ≤100\leq 100

  • 1≤1 \leq arr[i] ≤100\leq 100

  • 1≤1 \leq m ≤100\leq 100

  • 2≤2 \leq k ≤100\leq 100

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Detect Pattern of Length M Repeated K or More Times

med
30 min
Try to solve the Detect Pattern of Length M Repeated K or More Times problem.

Statement

Given an array of positive integers arr, determine if there is a contiguous subarray of length m that repeats kk or more consecutive times.

A pattern is a sequence of consecutive elements. A repetition of this pattern consists of the exact same sequence appearing at least kk times back to back without interruption.

Return true if any such pattern exists, and false otherwise.

Constraints:

  • 2≤2 \leq arr.length ≤100\leq 100

  • 1≤1 \leq arr[i] ≤100\leq 100

  • 1≤1 \leq m ≤100\leq 100

  • 2≤2 \leq k ≤100\leq 100