using System;
using System.Collections.Generic;
using System.Linq;
//Write a function that determines if an array contains any duplicate subarray of size k.
//Use a hash-based approach to achieve O(n) average complexity.
class MainClass {
static void Main() {
int[] nums = { 1, 2, 3, 1, 2, 3, 4 };
int k = 3;
bool result = ProcessDuplicates(nums, k);
Console.WriteLine(result);
}
public static bool ProcessDuplicates(int[] nums, int k){
HashSet<int> set = new HashSet<int>();
foreach(var num in nums){
set.Add(num);
}
if((nums.Length - set.Count) == k){
return true;
}
return false;
}
}