fork download
  1. using System;
  2. using System.Linq;
  3.  
  4. public class Test
  5. {
  6. public static void Main()
  7. {
  8. byte[] large = new byte[100];
  9. for (byte i = 0; i < 100; i++) {
  10. large[i] = i;
  11. }
  12. byte[] small = new byte[] { 23, 24, 25 };
  13. var res = Enumerable
  14. .Range(0, large.Length-1)
  15. .Cast<int?>()
  16. .FirstOrDefault(n => large.Skip(n.Value).Take(small.Length).SequenceEqual(small));
  17. Console.WriteLine(res);
  18. }
  19. }
Success #stdin #stdout 0.05s 34072KB
stdin
Standard input is empty
stdout
23