Maximum Unique Element in every subarray of size K
Given an array and an integer K. We need to find the maximum of every segment of length K which has no duplicates in that segment. Examples: Input : a[] = {1, 2, 2, 3, 3}, K = 3. Output : 1 3 2 For segment (1, 2, 2), Maximum = 1. For segment (2, 2, 3), Maximum = 3. For segment (2, 3, 3), Maximum = 2