Problem 37. Pascal's Triangle
Solution Stats
Problem Comments
-
5 Comments
the last assertion is wrong
Oops, I guess I commented in the solution, not the problem. (What's the difference????) They should check if their answer is symmetrical, which it isn't, so their solution must be wrong regardless of subsequent values
I've removed the last assertion and rescored. Thanks for the note.
fun!
Fun!!
Solution Comments
-
1 Comment
I feel the code of this problem is not difficult. However, if we are not familiar with the properties of Pascal's Triangle, it needs to take more time.
-
1 Comment
a nice one-liner, again
-
1 Comment
Easy, but I enjoyed it nevertheless.
-
1 Comment
Used expm but the numbers didn't equal until I wrapped with int16.
-
1 Comment
using convolution
-
3 Comments
Size is 26. How do you get any less?
"y = arrayfun(@nchoosek, repmat(n, 1, n + 1), 0:n)" gives a score of 23
Good Qeustion
-
1 Comment
Why won't syms work? I can run this in MATLAB and it outputs the correct pascal line given n.
-
1 Comment
using cell
-
1 Comment
We used a subfunction Cpn(n,p)
Y=factorial(p)/(factorial(n)*factorial(p-n)) instead of the function "nchoosek" .
-
2 Comments
When I submitted the solution "y=round((2^n)*binopdf(0:n,n,0.5));" cody test aborted by saying "binopdf" is an undefined function. Strange !!
binopdf is part of the statistics toolbox, not core Matlab.
-
1 Comment
How about an assertion on whether or not the sides are symmetric?
This problem's last assertion is wrong :/
isequal(correct(1:27),correct(54:-1:28))
At first I thought it was an issue with accuracy on my end ...
Problem Recent Solvers3687
Suggested Problems
-
633 Solvers
-
1220 Solvers
-
Create a Multiplication table matrix...
375 Solvers
-
546 Solvers
-
Number of Even Elements in Fibonacci Sequence
987 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!