Deviopath › Go

Chunk a Slice

Medium · Slices

Split items into groups of size. The last group may be shorter. size is at least 1. An empty input returns an empty slice of chunks ([][]int{}).

Write Chunk(items, size).

Next: Remove Consecutive Duplicates