using System.Collections.Generic;
public static void Main()
var n = new[] { 2, 6, 4, 7, 9, 4, 3, 4 };
Console.WriteLine(Enumerable.SequenceEqual(FindNearesSmallest(n), new[] {-1, 2, 2, 4, 7, 2, 2, 3}));
IEnumerable<int> FindNearesSmallest(int[] input)
for (int i = 0; i < input.Length; i++)
for (var j = i - 1; j >= 0; j--)