NeetCode #229LC-3208MediumSliding Window
← Back to All Problems

#229 · #3208 · Alternating Groups II(交替组 II)

📌 Problem Statement & Constraints

There is a circle of colors[i] (0 or 1) and an integer k. An alternating group of size k is k consecutive tiles on the circle whose colours alternate. Return the number of such groups. Constraints: 3 <= colors.length <= 10^5, colors[i] is 0 or 1, 1 <= k <= colors.length.
🔒

Sign In to Unlock Full Solutions for All 973 Problems

Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!