public static void Test() { Solution s = new Solution(); //Console.WriteLine( //s.LongestSubarray(new[] { 4, 2, 2, 2, 4, 4, 2, 2 }, 0) //); //Console.WriteLine( // s.LongestSubarray(new[] { 8, 2, 4, 7 }, 4) // ); //[9,10,1,7,9,3,9,9] //7 //Console.WriteLine( // s.LongestSubarray(new[] { 9, 10, 1, 7, 9, 3, 9, 9 }, 7) //); //[2,2,2,4,4,2,5,5,5,5,5,2] // 2 Console.WriteLine( s.LongestSubarray(new[] { 2, 2, 2, 4, 4, 2, 5, 5, 5, 5, 5, 2 }, 2) ); Console.WriteLine( s.LongestSubarray(new[] { 24, 12, 71, 33, 5, 87, 10, 11, 3, 58, 2, 97, 97, 36, 32, 35, 15, 80, 24, 45, 38, 9, 22, 21, 33, 68, 22, 85, 35, 83, 92, 38, 59, 90, 42, 64, 61, 15, 4, 40, 50, 44, 54, 25, 34, 14, 33, 94, 66, 27, 78, 56, 3, 29, 3, 51, 19, 5, 93, 21, 58, 91, 65, 87, 55, 70, 29, 81, 89, 67, 58, 29, 68, 84, 4, 51, 87, 74, 42, 85, 81, 55, 8, 95, 39 }, 87) ); }