Company: Visa_28aug
Difficulty: medium
Count Contiguous Sections with K Unique Items Problem Description Imagine you are an inventory manager at a warehouse filled with various items represented by an array inventory . The warehouse employs a logistics system that can identify the uniqueness of items within specified sections of the warehouse. Given these sections represented by contiguous subarrays, your task is to determine how many of these sections contain at least k unique types of items. You are given the following function signature: int solution(vector<int> inventory, int k) { // Function body } Examples Example 1: Input: inventory = [1, 2, 1, 1], k = 2 Output: 2 Explanation: There are 2 sections that satisfy the condition for having at least k = 2 unique types of items: inventory[0..1] = [1, 2] inventory[1..2] = [2, 1] Note that the section inventory[0..2] = [1, 2, 1] is not counted because it contains the number 1 twice, and thus doesn't have 2 unique items. Example 2: Input: inventory = [1, 2, 3, 4, 1], k =