[C++] Top Down DP
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\n Describe your approach to solving the problem. \n\n# Complexity\n- Time 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int removeAlmostEqualCharacters(string word) {\n        int n = word.size();\n        \n        vector<int> memo(n, -1);\n        \n        function<int(int)> dp = [&](int i) {\n            if (i >= n) return 0;\n            \n            if (memo[i] != -1)\n                return memo[i];\n            \n            if (abs((word[i]-\'a\') - (word[i+1]-\'a\')) <= 1) {\n                return memo[i] = 1 + min(dp(i+1), dp(i+2));\n            }\n            \n            return memo[i] = dp(i+1);\n        };\n        \n        return dp(0);\n    }\n};\n```
['Dynamic Programming', 'C++']