Imed Jaberi 28908902ce
Improve the questions sub-folders names (#8850)
Co-authored-by: Anthony Fu <anthonyfu117@hotmail.com>
2022-04-19 12:04:56 +08:00

1.4 KiB

Chunk medium #tuple

by キリサメ qianxi @qianxi0410

Take the Challenge

Do you know lodash? Chunk is a very useful function in it, now let's implement it. Chunk<T, N> accepts two required type parameters, the T must be a tuple, and the N must be an integer >=1

type exp1 = Chunk<[1, 2, 3], 2> // expected to be [[1, 2], [3]]
type exp2 = Chunk<[1, 2, 3], 4> // expected to be [[1, 2, 3]]
type exp3 = Chunk<[1, 2, 3], 1> // expected to be [[1], [2], [3]]

Back Share your Solutions Check out Solutions