Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
2
Task/Pascals-triangle/Groovy/pascals-triangle-1.groovy
Normal file
2
Task/Pascals-triangle/Groovy/pascals-triangle-1.groovy
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
def pascal
|
||||
pascal = { n -> (n <= 1) ? [1] : [[0] + pascal(n - 1), pascal(n - 1) + [0]].transpose().collect { it.sum() } }
|
||||
4
Task/Pascals-triangle/Groovy/pascals-triangle-2.groovy
Normal file
4
Task/Pascals-triangle/Groovy/pascals-triangle-2.groovy
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
def count = 15
|
||||
(1..count).each { n ->
|
||||
printf ("%2d:", n); (0..(count-n)).each { print " " }; pascal(n).each{ printf("%6d ", it) }; println ""
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue