Created
January 31, 2023 19:19
-
-
Save ChrisDobby/7d8d03b4590672949fc455fa9085bd05 to your computer and use it in GitHub Desktop.
Given a positive integer, generate an array in which every element is an array that goes from 1 to the index of that array.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateArrays = (n: number) => Array.from({ length: n }, (_, index) => Array.from({ length: index + 1 }, (_, innerIndex) => innerIndex + 1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment