We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
def factoriel(y: Int): Int = (1 to y).foldLeft(1)(_ * _)
var k = sc.nextInt();
(0 until k).foreach( n => {
val rowToPrint = (0 to n).map( r => {
factoriel(n) / (factoriel(r) * factoriel(n -r))
}).mkString(" ")
println(rowToPrint)
})
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Pascal's Triangle
You are viewing a single comment's thread. Return to all comments →