Can anyone tell me what's the problem with this solution?
So the idea is we use tempResult[i][j] to record number of result in i + 1th roll ending with j + 1\nThe computation of tempResult[i][j] should be equal to the 
So the idea is we use `tempResult[i][j]` to record number of result in `i + 1`th roll ending with `j + 1`\nThe computation of `tempResult[i][j]` should be equal to the sum of previous results `tempResult[i - 1][j]` from `j = 0` to `j = 5` and minus `tempResult[i - rollMax[j]][j]` because we don\'t want to include the result where the `i - rollMax[j]`th roll ending in `j`, and that will break the restriction. I got wrong answer with this solution, but I don\'t know why. Can anyone help?\n```\nclass Solution {\n    int MOD = 1e9 + 7;\npublic:\n    int dieSimulator(int n, vector<int>& rollMax) {\n        vector<vector<int>> tempResults(n, vector<int>(6, 0));\n        for (int i = 0; i < 6; i++) {\n            tempResults[0][i] = 1;\n        }\n        \n        for (int i = 1; i < n; i++) {\n            int sum = 0;\n            for (int j = 0; j < 6; j++) {\n                sum = (sum + tempResults[i - 1][j]) % MOD;\n            }\n            for (int j = 0; j < 6; j++) {\n                if (i - rollMax[j] >= 0) {\n                    tempResults[i][j] = (sum - tempResults[i - rollMax[j]][j]) % MOD;\n                } else {\n                    tempResults[i][j] = sum;\n                }\n            }\n        }\n        \n        int result = 0;\n        for (int i = 0; i < 6; i++) {\n            result = (result + tempResults[n - 1][i]) % MOD;\n        }\n        \n        return result;\n    }\n};\n```
[]