using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
public static void Main()
List<char> left = new List<char>() { '7', '1', '2', '3', '4', '5', '9', '7','7','1' };
List<char> right = new List<char>() {'1', '1', '2', '2', '3', '4', '5', '5', '5','5','5' };
Stopwatch watch = new Stopwatch();
.ToDictionary(chunk => chunk.Key, chunk => chunk.Count());
.SelectMany(chunk => chunk.Skip(counts.TryGetValue(chunk.Key, out var skip) ? skip : 0))
TimeSpan tHash = watch.Elapsed;
Console.WriteLine("Output: " + string.Join(",", result) + " in " + watch.ElapsedTicks + " ticks.");
var difference = left.ToList();
foreach (var entry in right) {
difference.Remove(entry);
TimeSpan tInitial = watch.Elapsed;
Console.WriteLine("Output: " + string.Join(",", difference) + " in " + watch.ElapsedTicks + " ticks.");
Console.Write($"Hash: {tHash}; Initial {tInitial}");
left = new List<char>() { '7', '1', '2', '3', '4', '5', '9', '7','7','1' };
right = new List<char>() {'1', '1', '2', '2', '3', '4', '5', '5', '5','5','5' };
right.ForEach(item => left.Remove(item));
Console.WriteLine("Output: " + string.Join(",", right) + " in " + watch.ElapsedTicks + " ticks.");