class PascalsTriangle {
    companion object {
        fun computeTriangle(row: Int): List<List<Int>>{
            require(row >= 0){}
            val returnList = mutableListOf<MutableList<Int>>()
            for (i in 0..row-1){
                val tempList = mutableListOf<Int>()
                for (j in 0..i){
                    tempList.add(pascal(i,j))
                }
                returnList.add(tempList)
            }
            return returnList
        }

        private fun pascal(i: Int, j: Int): Int {
            if (j == 0) {
                return 1
            } else if (j == i) {
                return 1
            } else {
                return pascal(i - 1, j - 1) + pascal(i - 1, j)
            }

        }
    }
}