i have a list which have some values in it
for (int i = 0; i < InputNumbers.Length; i++)
{
InputNumbers[i] = Convert.ToInt32(Console.ReadLine());
LongestSequence.Add(InputNumbers[i]);
}
for (int i = 0; i < InputNumbers.Length; i++)
{
if (i > 0)
{
if (LongestSequence[i] < LongestSequence[i - 1])
{
LongestSequence.Remove(LongestSequence[i]);
LongestSequence.Insert(i, null);
}
}
}
As you can see im adding all the values from my array InputNumbers to the list LongestSequence and after this is done im removing some of those values and inserting "null" at the replaced value index. So this creates something like border :
null
1
2
null
i want to know the length of the values between those 2 null's.In this case it's 2
- if the input is 1 2 3 0 the null will be at the start and will replace the zero because 0 is lower than 3 and im looking for the longest non decreasing sequence