public static int Solution(int[] input)
while (index < input.Length && input[index] < 1)
while (index < input.Length)
if (input[index] > expected)
while (index < input.Length && input[index] == expected)
public static void Main()
var arr = new int[]{1, 3, 6, 4, 1, 2};
if (arr.Length < 100000 && low > -1000000 && high < 1000000)
Console.WriteLine(Solution(arr));
var arr1 = new int[]{1, 2, 3};
if (arr1.Length < 100000 && low1 > -1000000 && high1 < 1000000)
Console.WriteLine(Solution(arr1));
var arr2 = new int[]{-1, -3};
if (arr2.Length < 100000 && low2 > -1000000 && high2 < 1000000)
Console.WriteLine(Solution(arr2));