Pyramid Puzzle
Read at your own pace. Code execution, quizzes, progress tracking, and the AI tutor are available in the interactive view with JavaScript enabled.
Question
In a certain kind of pyramid, each number in a row is the sum of the two numbers directly above it (arranged in a triangular fashion).

Given an integer n, return the first of the n rows of the pyramid.
For example, if n = 5, then the first 5 rows of the pyramid will be represented in the array form as follows,
[[1], [1, 1], [1, 2, 1], [1, 3, 3, 1], [1, 4, 6, 4, 1]]
Constraints
- 1 <=
n<= 30
CONTINUE WITH ALGODAILY PREMIUM
Keep going with the complete tutorial.
Unlock the remaining explanations and exercises, alongside the full learning library.
Explore Premium →