EASY C++ SOLUTION🚀 WITH EXPLANATION..DP | MEMOIZATION
Intuition//intution:
// suppose kro hm kisi bhi index ith pe hai to mera goal ye hona chaiye ki hm jis index pe hai uska cost aur sath me jo mera mirror index(n
# Intuition
//intution:
        // suppose kro hm kisi bhi index ith pe hai to mera goal ye hona chaiye ki hm jis index pe hai uska cost aur sath me jo mera mirror index(n-ith-1) hai uska bhi cost sath me calculate kar le...so ye kaise hoga:
        // 1st:cond->curr index ka jo j hai wo prev index ke j ke sath match na ho aur similarly next index ke j ke sath bhi match na ho...
        //use 2 for loops to calculate all possible minimum value and add them

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
**O(N * 4 * 4)**


- Space complexity:
**O(N * 4 * 4**)

# Code
```cpp []
class Solution {
public:
   long long solve(int i,int last,int next,int n,vector<vector<int>>& cost,vector<vector<vector<long long>>>&dp){
    //base
    if(i>=n/2){
        return 0;
    }

    if(dp[i][last+1][next+1]!=-1){
        return dp[i][last+1][next+1];
    }


    long long mini=LLONG_MAX;
    for(int j=0; j<3; j++){
      for(int k=0; k<3; k++){
        if(j!=k && j!=last && k!=next){
            mini=min(mini,cost[i][j]+cost[n-i-1][k]+solve(i+1,j,k,n,cost,dp));
        }
      }
    }
    return dp[i][last+1][next+1]=mini;
   }
    long long minCost(int n, vector<vector<int>>& cost) {
        //JAI MATA DI
        //intution:
        // suppose kro hm kisi bhi index ith pe hai to mera goal ye hona chaiye ki hm jis index pe hai uska cost aur sath me jo mera mirror index(n-ith-1) hai uska bhi cost sath me calculate kar le...so ye kaise hoga:
        // 1st:cond->curr index ka jo j hai wo prev index ke j ke sath match na ho aur similarly next index ke j ke sath bhi match na ho...
        //use 2 for loops to calculate all possible minimum value and add them


        vector<vector<vector<long long>>>dp(n+1,vector<vector<long long>>(4,vector<long long>(4,-1)));
    return solve(0,-1,-1,n,cost,dp);
    }
};
```
['Dynamic Programming', 'Recursion', 'Memoization', 'C++']