Day 22 refactor - 2-3x speedup from changing infinite lookup method
This new method fixes the hands-seen-before check to be actually correct
Unsure how I got the correct answers with that being wrong. 🤷
This commit is contained in:
18
Extensions.cs
Normal file
18
Extensions.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace _2020
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static T PopFront<T>(this ICollection<T> list)
|
||||
{
|
||||
T val = list.First();
|
||||
list.Remove(val);
|
||||
return val;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user