Advertisement
Guest User

Untitled

a guest
Jul 31st, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2.  
  3. namespace HelloWorld
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int[] array1 = { 2, 4, 3, 201, 1003, 1, 6, -20, 10000, -30, 10, 200303 };
  10. int[] array2 = { 10, -2, 1000, 5, -300, -200, -1000, 100, 7, 8, 9, 10000, -2042, 32021 };
  11.  
  12. Array.Resize(ref array2, array2.Length + array1.Length);
  13. Array.Copy(array1, 0, array2, array1.Length, array1.Length);
  14. Array.Sort(array2);
  15. int x = 1;
  16. int lowestUnmatched = 0;
  17. foreach (int i in array2)
  18. {
  19. if (i < 1) continue;
  20. if (i != x)
  21. {
  22. Console.WriteLine(x);
  23. break;
  24. } else {
  25. while (x <= 100000)
  26. {
  27. x = x + 1;
  28. if (i != x)
  29. {
  30. if (lowestUnmatched == i)
  31. {
  32. Console.WriteLine(lowestUnmatched);
  33. return;
  34. }
  35. lowestUnmatched = i;
  36. break;
  37. }
  38.  
  39. }
  40. }
  41.  
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement