Sobes.tech
Middle

// případ 2 // implementujte rozšíření chunkwhile: // - spojuje sousední prvky do skupin, dokud samegroup(prev, current) == true. var data = new[] { 1, 3, 5, 2, 4, 4, 7 }; var chunks = data.chunkwhile((prev, curr) => (prev % 2) == (curr % 2)); foreach (var chunk in chunks) { Console.WriteLine($"[{string.Join(", ", chunk)}]"); } public static class case2class { public static IEnumerable<IReadOnlyList<T>> chunkwhile<T>( this IEnumerable<T> source, Func<T, T, bool> samegroup) { throw new NotImplementedException(); } }