tracks/kotlin/exercises/pascals-triangle/.meta/src/reference/kotlin/PascalsTriangle.kt in trackler-2.2.1.62 vs tracks/kotlin/exercises/pascals-triangle/.meta/src/reference/kotlin/PascalsTriangle.kt in trackler-2.2.1.63
- old
+ new
@@ -7,10 +7,10 @@
return (1..rows).map { buildTriangleRow(it) }
}
private fun buildTriangleRow(row: Int): List<Int> {
var m = 1
- return listOf(1) + (1..row - 1).map { col ->
+ return listOf(1) + (1 until row).map { col ->
m = m * (row - col) / col
return@map m
}
}
}