Created
August 19, 2015 12:03
-
-
Save vdonchev/8db58cd5b9360b7c8c87 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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