Company: Visa_28aug
Difficulty: medium
Contiguous Fruit Sections with K Pairs Problem Description You work as a quality inspector at a sizable fruit packing facility. Once picking is done, the fruits travel single-file along a conveyor belt. Your task is to find stretches of the belt that contain a meaningful amount of matching fruit. More precisely, count how many contiguous stretches of the belt allow forming at least k pairs of matching fruit, based on their positions on the belt. Any single fruit at a given position can only belong to one pair when counting toward the k pairs. Your solution should implement the following function: int solution(vector<int> fruits, int k) { // ... your code here } Input: fruits : An array of integers representing the sequence of fruits on the conveyor belt. k : A positive integer representing the minimum number of pairs to count. Output: An integer representing the number of contiguous sections which contain at least k pairs of identical fruits. Execution Time Limit: 0.5 seconds (cp