// atvejis 2
// įgyvendinkite chunkwhile išplėtimą:
// - sujungia šalia esančius elementus į grupes, kol 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();
}
}