6 kyu
Simple Fun #214: Pascal Matrix
83 of 123myjinxin2015
Description:
Task
Create an n × x
rectangular matrix resembling Pascal's Triangle. To make it more triangle-like, put 0
between each pair of numbers in one row.
Input/Output
[input]
integern
An
odd
number, the number of elements in the last row.3 ≤ n ≤ 65
[output]
2D integer arrayPascal's Triangle.
Example
pascalMatrix(3) =
[[0,1,0],
[1,0,1]]
pascalMatrix(5) =
[[0,0,1,0,0],
[0,1,0,1,0],
[1,0,2,0,1]]
pascalMatrix(9) =
[[0,0,0,0,1,0,0,0,0],
[0,0,0,1,0,1,0,0,0],
[0,0,1,0,2,0,1,0,0],
[0,1,0,3,0,3,0,1,0],
[1,0,4,0,6,0,4,0,1]]
Puzzles
Mathematics
Algorithms
Matrix
Similar Kata:
Stats:
Created | Apr 26, 2017 |
Published | Apr 26, 2017 |
Warriors Trained | 253 |
Total Skips | 16 |
Total Code Submissions | 299 |
Total Times Completed | 123 |
JavaScript Completions | 83 |
Python Completions | 47 |
Total Stars | 4 |
% of votes with a positive feedback rating | 92% of 54 |
Total "Very Satisfied" Votes | 47 |
Total "Somewhat Satisfied" Votes | 5 |
Total "Not Satisfied" Votes | 2 |
Total Rank Assessments | 5 |
Average Assessed Rank | 5 kyu |
Highest Assessed Rank | 5 kyu |
Lowest Assessed Rank | 6 kyu |