Skip to content

Instantly share code, notes, and snippets.

@unilecs
Created October 22, 2018 03:18
Show Gist options
  • Save unilecs/724932323d78b5c03b0074d59f67ddf1 to your computer and use it in GitHub Desktop.
Save unilecs/724932323d78b5c03b0074d59f67ddf1 to your computer and use it in GitHub Desktop.
Задача 134: Пропущенный символ
using System;
public class Program
{
public static char GetRemovedSymbol(char[] first, char[] second)
{
char removedSymbol = '\0';
for (int i = 0; i < first.Length; i++)
{
removedSymbol ^= first[i];
}
for (int i = 0; i < second.Length; i++)
{
removedSymbol ^= second[i];
}
return removedSymbol;
}
public static void Main()
{
Console.WriteLine("UniLecs");
char[] first = new char[] { 'a', 'b', 'c' };
char[] second = new char[] { 'a', 'b' };
Console.WriteLine(string.Format("Answer = {0}", GetRemovedSymbol(first, second))); // 'c'
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment