Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class MaxIncreasingSequence
- {
- static void Main()
- {
- int start = 0;
- int newStart = 0;
- int count = 1;
- int newCount = 1;
- int[] array = {1,2,3,5,6,8,9,0,1,4,5,6,7,8,1};
- for (int i = 0; i < array.Length - 1; i++)
- {
- if (array[i] < array[i + 1])
- {
- count++;
- if (count > newCount)
- {
- newCount = count;
- newStart = start;
- }
- }
- else
- {
- count = 1;
- start = i + 1;
- }
- }
- for (int i = newStart; i < newStart + newCount; i++)
- {
- Console.Write(array[i] + " ");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement