6 kyu
Pascal's Triangle
1,605 of 11,680boatmeme
Description:
In mathematics, Pascal's triangle is a triangular array of the binomial coefficients expressed with formula
where n
denotes a row of the triangle, and k
is a position of a term in the row.
You can read Wikipedia article on Pascal's Triangle for more information.
Task
Write a function that, given a depth n
, returns n
top rows of Pascal's Triangle flattened into a one-dimensional list/array.
Example:
n = 1: [1]
n = 2: [1, 1, 1]
n = 4: [1, 1, 1, 1, 2, 1, 1, 3, 3, 1]
Arrays
Mathematics
Algorithms
Similar Kata:
Stats:
Created | Sep 4, 2013 |
Published | Sep 4, 2013 |
Warriors Trained | 28192 |
Total Skips | 6495 |
Total Code Submissions | 73792 |
Total Times Completed | 11680 |
JavaScript Completions | 5574 |
Ruby Completions | 1380 |
CoffeeScript Completions | 196 |
C# Completions | 1390 |
Haskell Completions | 494 |
PHP Completions | 623 |
Python Completions | 1605 |
Crystal Completions | 14 |
Java Completions | 327 |
Rust Completions | 169 |
C++ Completions | 344 |
C Completions | 85 |
COBOL Completions | 4 |
Total Stars | 640 |
% of votes with a positive feedback rating | 90% of 1502 |
Total "Very Satisfied" Votes | 1250 |
Total "Somewhat Satisfied" Votes | 218 |
Total "Not Satisfied" Votes | 34 |