Description
Solutions
Submission
Tally the Number of Friend Groups with K Sets of Matching Traits 🐰

Once upon a time, in a land filled with numbers, there was a group of friends called "friendsList." They were on a quest, guided by a positive number named "minimumPairs." Their mission was to count how many groups of adjacent friends there were, where at least "minimumPairs" of them shared the same characteristics.

In other words, they needed to find out how many groups of friends walked together, where there were twice as many friends (each at different positions) who were just like each other, as required by the "minimumPairs" rule.

After exploring their journey for a while, they came back with the total count of such groups, having completed their mission successfully.

For original prompt, please refer to source image. 🐳

Example 1:

Input:  friendList = [0, 1, 0, 1, 0], minimumPairs = 2
Output: 3
Explanation:
Three friend groups meet the criteria of having at least minimumPairs = 2 pairs of matching traits: The first group, consisting of friends 0, 1, 2, and 3, where friend 0 is alike friend 2, and friend 1 is alike friend 3. The second group, including friends 1, 2, 3, and 4, where friend 1 matches friend 3, and friend 2 matches friend 4. The third group, comprising friends 0 through 4, where friend 0 matches friend 2, friend 1 matches friend 3, and friend 2 matches friend 4. In each of these friend groups, there exists at least one pair of friends with the same traits.

Example 2:

Input:  friendList = [2, 2, 2, 2, 2], minimumPairs = 3
Output: 1
Explanation:
Explanation not found.
Constraints:
    Unknown for now
Thumbnail 0
Thumbnail 1
Testcase

Result
Case 1

input:

output: