diff --git a/AoC_2025/Day08.cs b/AoC_2025/Day08.cs index 22f3284..374c91f 100644 --- a/AoC_2025/Day08.cs +++ b/AoC_2025/Day08.cs @@ -123,10 +123,14 @@ public class Day08 return combinations; } - private IEnumerable<(TValue a, TValue b)> Combinations(IEnumerable values) + private IEnumerable<(TValue a, TValue b)> Combinations(IEnumerable values) where TValue:IComparable { - var enumerated = values.ToArray(); - return enumerated - .SelectMany((valueA, ix) => enumerated.Skip(ix + 1).Select(valueB => (valueA, valueB))); + var enumeratedValues = values.Index().ToArray(); + var pairs = + from a in enumeratedValues + from b in enumeratedValues + where a.Index < b.Index + select (a.Item, b.Item); + return pairs; } } \ No newline at end of file