namespace AdventOfCode.Utils; public static class Extensions { /// /// Returns a slice of the given list /// /// The list you pretend to slice /// The first index of the slice /// The index after the last index of the slice /// public static List Sublist(this List list, int startIndex, int endIndex) { List result = new List(); for (int i = startIndex; i < endIndex; i++) result.Add(list[i]); return result; } /// /// Returns a column of a give matrix list /// /// 2 dimensions list /// Column index /// public static List GetColumn(this List> list, int column) { List result = new List(); foreach (List row in list) result.AddRange(row.Where((t, i) => i == column)); return result; } }