Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace HelloWorld
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[] array1 = { 2, 4, 3, 201, 1003, 1, 6, -20, 10000, -30, 10, 200303 };
- int[] array2 = { 10, -2, 1000, 5, -300, -200, -1000, 100, 7, 8, 9, 10000, -2042, 32021 };
- Array.Resize(ref array2, array2.Length + array1.Length);
- Array.Copy(array1, 0, array2, array1.Length, array1.Length);
- Array.Sort(array2);
- int x = 1;
- int lowestUnmatched = 0;
- foreach (int i in array2)
- {
- if (i < 1) continue;
- if (i != x)
- {
- Console.WriteLine(x);
- break;
- } else {
- while (x <= 100000)
- {
- x = x + 1;
- if (i != x)
- {
- if (lowestUnmatched == i)
- {
- Console.WriteLine(lowestUnmatched);
- return;
- }
- lowestUnmatched = i;
- break;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement