using System.Collections.Generic;
using System.Collections;
static void Main(string[] args)
int[] a = new int[] {3,-1,-1,2,5,-3,-2,3,1,2,3,4,5};
Console.WriteLine("Test array: [ " + string.Join(", ", Array.ConvertAll<int, string>(a, n => n.ToString())) + " ]");
Console.WriteLine("The start index is: " + GetStartIndex(a));
private static int GetStartIndex(int[] a)
if((a[i]>a[j]) && temp[i]<temp[j]+1){
if(index<temp[i])index=temp[i];
Console.WriteLine("index array: [ " + string.Join(", ", Array.ConvertAll<int, string>(temp, n => n.ToString()))+ " ]");
Console.WriteLine("There is an Error in program " + ex.Message + ex.StackTrace);