Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class IncreasingSequence
- {
- static void Main()
- {
- int[] array = { 3, 2, 3, 4, 2, 4, 5, 6, 1};
- int length=0;
- int maxLength=0;
- string sequence=null;
- string maxSequence=null;
- for (int i = 0; i < 9-1; i++)
- {
- if (array[i] < array[i + 1])
- {
- length++;
- sequence += array[i];
- }
- else if (length >= maxLength)
- {
- maxLength = length;
- maxSequence = sequence+array[i];
- sequence = null;
- length = 0;
- }
- }
- Console.WriteLine(maxSequence);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement