3 ms·
Just an asie: Printing Pascal's triangle for upto 10 rows is trivial. The factorials don't get big enough so you can simply use binomial coefficients (like in y
by dxbydt 15y ago
Just an asie: Printing Pascal's triangle for upto 10 rows is trivial. The factorials don't get big enough so you can simply use binomial coefficients (like in your ruby solution). But if you want Pascal's triangle for the 10,000th row => You can use what I wrote. If you have an easier implementation, I'd be very interested.
- it 15y agoHere's a way to do it in Haskell: let step row = zipWith (+) (0:row) (row++[0]) let triangle = iterate step [1] take 10 triangle