[C++] Easy understand 3D DP solution
\nclass Solution {\npublic:\n    long long get_previous_ways(vector<vector<vector<long long>>> &dp, int times, int current_dice) {\n        long long ways = 0;\
```\nclass Solution {\npublic:\n    long long get_previous_ways(vector<vector<vector<long long>>> &dp, int times, int current_dice) {\n        long long ways = 0;\n        for (int k = 0; k < 6; ++k) {\n            if (k == current_dice) {\n                continue;\n            }\n\n            for (int j = 1; j < 16; ++j) {\n                ways += dp[k][j][times - 1];\n                ways %= 1000000007;\n            }\n        }\n        \n        return ways;\n    }\n    \n    int dieSimulator(int n, vector<int>& rollMax) {\n        vector<vector<vector<long long>>> dp(6, vector<vector<long long>>(16, vector<long long> (n + 1, 0)));\n        \n        for (int k = 0; k < 6; ++k) {\n            dp[k][1][1] = 1;\n        }\n        \n        for (int i = 2; i <= n; ++i) {\n            for (int k = 0; k < 6; ++k) {\n                dp[k][1][i] = get_previous_ways(dp, i, k);\n            }\n            \n            for (int j = 2; j <= i; ++j) {    \n                for (int k = 0; k < 6; ++k) {\n                    if (rollMax[k] < j) {\n                        continue;\n                    }\n                    \n                    dp[k][j][i] = dp[k][j - 1][i - 1];\n                }\n            }\n        }\n        \n        long long ans = 0;\n        \n        for (int k = 0; k < 6; ++k) {\n            for (int j = 0; j < 16; ++j) {\n                ans += dp[k][j][n];\n                ans %= 1000000007;\n            }\n        }\n        \n        return ans;\n    }\n};\n```
[]