Skip to content

Latest commit

 

History

History
15 lines (9 loc) · 1.6 KB

File metadata and controls

15 lines (9 loc) · 1.6 KB

FlattenDepth medium #array

by jiangshan @jiangshanmeta

Take the Challenge

Recursively flatten array up to depth times.

For example:

type a = FlattenDepth<[1, 2, [3, 4], [[[5]]]], 2> // [1, 2, 3, 4, [5]]. flattern 2 times
type b = FlattenDepth<[1, 2, [3, 4], [[[5]]]]> // [1, 2, 3, 4, [[5]]]. Depth defaults to be 1

If the depth is provided, it's guaranteed to be positive integer.


Back Share your Solutions Check out Solutions

Related Challenges

459・Flatten