Advertisement
Guest User

Untitled

a guest
Jul 18th, 2019
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System.Collections.Generic;
  2. using System.Linq;
  3.  
  4. namespace ConsoleApp3
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. List<int> list = new List<int> { 30000, 30001, 30003, 30004 };
  11.  
  12. var next = list[list
  13. .OrderBy(i => i)
  14. .Skip(1)
  15. .Zip(list, (curr, prev) => curr - prev)
  16. .Select((diff, index) => new { diff, index })
  17. .First(x => x.diff > 1).index] + 1;
  18. }
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement