Maximizing sum of non-consecutive elements in Matrix
#include <bits/stdc++.h>using namespace std; int maximumPointsUtil(int index, int dp, vector<vector<int> >& points){ if (dp != -1) return dp; int row = index / 3; int col = index % 3; if (col == 0) { dp = points + max( maximumPointsUtil(index + 4, dp, points), maximumPointsUtil(index + 5, dp, points)); return dp; } else if (col == 1) { dp = points +…