fun main() {
	combination(0, 0)
}

class Solution {
	val combinationNumbers = mutableListOf<Int>()
    val numbers = intArrayOf(1, 2, 3, 4)

    fun combination(currentIndex: Int, depth: Int) {
        if (depth == goalDepth) {
            println(combinationNumbers) // [1, 2, 3] -> [1, 2, 4] -> [1, 3, 4] -> [2, 3, 4]
            combinationGroup.add(combinationNumbers.toList())
            return
        }

        for (i in currentIndex until numbers.size) {
            combinationNumbers.add(numbers[i])
            combination(i + 1, depth + 1)
            combinationNumbers.removeAt(combinationNumbers.lastIndex)
        }
    }
    
    companion object {
        val goalDepth = 3
    }
}