fork(1) download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. public class Test
  6. {
  7. public static void Main()
  8. {
  9. var list = new[] { 80,81,90,90,90,90,90,90,100,85,86,86,79,95,95,95,95 };
  10. var dupes = new List<int>();
  11. int? prev = null;
  12. for(var i = 2; i < list.Length; i++) {
  13. if(list[i] == list[i - 1] && list[i] == list[i - 2]) {
  14. if(!prev.HasValue || prev.Value != list[i]) {
  15. dupes.Add(list[i]);
  16. prev = list[i];
  17. }
  18. }
  19. }
  20. Console.WriteLine(string.Join(", ", dupes.Select(n => n.ToString()).ToArray()));
  21. }
  22. }
Success #stdin #stdout 0.03s 33984KB
stdin
Standard input is empty
stdout
90, 95