Tally the Number of Friend Groups with K Sets of Matching Traits
Asked in Trade_desk interviews, this coding interview problem provides a friendsList array and a positive minimumPairs. Count how many contiguous groups (subarrays) contain at least minimumPairs pairs of friends with matching traits at different positions. This interview question focuses on returning the total number of adjacent groups that meet the pair-matching requirement.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
