C++ | Sliding Window Standard Problem | O(n)
Intuition:\n\nTrack using two pointers and keep on adding the cost in variable and keep on increasing the window towards right.\nOnce the variable value exceed 
**Intuition:**\n\nTrack using two pointers and keep on adding the cost in variable and keep on increasing the window towards right.\nOnce the variable value exceed maxcost, reduce the window size from left.\n\n**Solution:**\n\n```\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost) {\n        \n        int n = s.length();\n        \n        int i = 0, j = 0, d = 0, res = 0;\n        for (i = 0; i < n; i++) {\n            d += abs(s[i] - t[i]);\n            while (j < n && d > maxCost) {\n                d -= abs(s[j] - t[j]);\n                j++;\n            }\n            res = max(res, i-j+1);\n        }\n        \n        return res;\n    }\n};\n```
[]