Skip to content

Instantly share code, notes, and snippets.

@vdonchev
Created August 19, 2015 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vdonchev/8db58cd5b9360b7c8c87 to your computer and use it in GitHub Desktop.
Save vdonchev/8db58cd5b9360b7c8c87 to your computer and use it in GitHub Desktop.
namespace Program
{
using System;
using System.Collections.Generic;
class Program
{
static void Main(string[] args)
{
int[] arr = { 1, 8, 3, 17, 22, 33 };
List<int> seq = new List<int>();
for (int i = 0; i < arr.Length; i++)
{
List<int> tempList = new List<int>() { arr[i] };
for (int j = i + 1; j < arr.Length; j++)
{
if (arr[j] > arr[j - 1])
{
tempList.Add(arr[j]);
}
else
{
break;
}
}
if (tempList.Count > seq.Count)
{
seq.Clear();
seq.AddRange(tempList);
}
}
Console.WriteLine(string.Join(", ", seq));
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment