✅ C++ || 3 Lines only || Sliding window
c++\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost, int res = 0) {\n        for (int i = 0, left = 0, counting = 0; i < cost
```c++\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost, int res = 0) {\n        for (int i = 0, left = 0, counting = 0; i < cost.size(); i++) {\n            counting += abs(s[i] - t[i]);\n            while (counting > maxCost) counting -= cost[left++];\n            res = max(res, i - left + 1);\n        }\n        return res;\n    }\n};\n```\n\n**For more solutions, check out this \uD83C\uDFC6  [GITHUB REPOSITORY](https://github.com/MuhtasimTanmoy/playground) with over 1500+ solutions.**
[]