Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace TestApplication
- {
- internal class Program
- {
- private static void Main(string[] args)
- {
- var array = new[] {1, 5, 2, 2, 2, 2, 4, 5, 5, 5, 1, 1, 2, 5};
- int maxStreak = 0, curStreak = 0;
- for (var i = 1; i < array.Length; i++)
- {
- if (array[i] == array[i - 1]) curStreak++;
- else
- {
- if (curStreak >= maxStreak) maxStreak = curStreak;
- curStreak = 0;
- }
- }
- Console.WriteLine(maxStreak);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement