public int solution(int n, int count) {
if (n == count) {
return 1;
}
long[][] dp = new long[n + 1][count + 1];
dp[0][0] = 1;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <= count; j++) {
dp[i][j] = calculateDpValue(dp, i, j);
}
}
return (int) dp[n][count];
}
private long calculateDpValue(long[][] dp, int i, int j) {
return (dp[i - 1][j - 1] + 2L * (i - 1) * dp[i - 1][j]) % 1000000007;
}
출처:https://school.programmers.co.kr/learn/courses/30/lessons/140105