You are viewing a single comment's thread. Return to all comments →
def pascal(input: Int): Array[Int] = { if(input == 1) { println(1) Array.empty } else { val result = 1 +: pascal(input - 1).sliding(2).map(_.sum).toArray :+ 1 println(result.mkString(" ")) result } }
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 →