[Algorithm] 순열 조합
·
Algorithm/Algorithm (이론)
순열 N : 자연수 R : 뽑을 갯수 nPr 구하기! 자연수 import org.junit.jupiter.api.Test import java.util.* class Permutation { private var N: Int = 0 private var R: Int = 0 private fun dfs(curNum: Int, visited: BooleanArray, depth: Int, strBuilder: StringBuilder, answerList: LinkedList) { strBuilder.append(curNum) if (depth == R) { answerList.add(strBuilder.toString().toInt()) strBuilder.setLength(strBuilder.length..