[C++] Simple explanation
Intuition\nThe n-1 move limit makes this a bit simple to solve.\n- The guy at the top left can only travel the diagonal \n- The guys at the other corners have t
# Intuition\nThe n-1 move limit makes this a bit simple to solve.\n- The guy at the top left can only travel the diagonal \n- The guys at the other corners have to keep moving towards the target to reach it with the n-1 move limit\n\nSo we can get the result as \nthe sum of the main diagonal + values at the target after [max path sum in triangle matrix](https://leetcode.com/problems/triangle/description/) from each corner.\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n$$O(n^2)$$\n\n- Space complexity:\n$$O(n^2)$$\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int maxCollectedFruits(vector<vector<int>>& fruits) {\n        int res = 0, n = fruits.size();\n        for(int i=0; i<n; i++) {\n            res += fruits[i][i];\n            fruits[i][i] = 0;\n        }\n        vector<vector<int>> temp(n, vector<int>(n));\n        temp[0].back() = fruits[0].back();\n        for(int i=0; i<n-1; i++) {\n            for(int j=n-i-1; j<n; j++) {\n                if(j-1 >= 0) temp[i+1][j-1] = max(temp[i+1][j-1], temp[i][j]+fruits[i+1][j-1]);\n                temp[i+1][j] = max(temp[i+1][j], temp[i][j] + fruits[i+1][j]);\n                if(j+1 < n) temp[i+1][j+1] = max(temp[i+1][j+1], temp[i][j]+fruits[i+1][j+1]);\n            }\n        }\n        res += temp.back().back();\n        temp = vector<vector<int>>(n, vector<int>(n));\n        temp.back()[0] = fruits.back()[0];\n        for(int i=0; i<n-1; i++) {\n            for(int j=n-i-1; j<n; j++) {\n                if(j-1 >= 0) temp[j-1][i+1] = max(temp[j-1][i+1], temp[j][i]+fruits[j-1][i+1]);\n                temp[j][i+1] = max(temp[j][i+1], temp[j][i] + fruits[j][i+1]);\n                if(j+1 < n) temp[j+1][i+1] = max(temp[j+1][i+1], temp[j][i]+fruits[j+1][i+1]);\n            }\n        }\n        res += temp.back().back();\n        return res;\n    }\n};\n```
['C++']