Laundry - sort socks
You're using some poor methods when there are better options available to the data types you've picked.

A huge bottleneck is hidden in those 2 lines:


Sock = Laundry.ElementAt(rand.Next(Laundry.Count));
Laundry.Remove(Sock);



Let's see why

General vs specific methods

ElementAt is an extension method of the type IEnumerable&lt;T&gt;, the List&lt;T&gt; is inheriting IEnumerable&lt;T&gt; but guess what, so are most of the collections in C#. That means when you write a method that is applicable to so many types, you need to make it as generic/general as possible while still maintaining reasonable performance, but of course using a concrete implementation of that method for said collection would be faster. You can do that because you are 100% sure that the optimizations will always be valid.

So the first thing is to replace the ElementAt() with normal indexer.

RemoveAt() vs Remove()

In most cases Remove() would be a O(n) operation where RemoveAt() would be O(1) operation. The first uses the latter internally so it's always better to use this method when you know what index you want to remove, guess what, you already know what index you're removing:

int index = rand.Next(Laundry.Count);
Sock = Laundry[index];
Laundry.RemoveAt(index);




Besides that you're never utilizing the collection Matched. You're just wasting time adding stuff into it without ever touching them.



Adding those changes made the code about 2.5 times faster. On average from 45ms  to about 17ms per run.