simplest C++
\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost) {\n        vector<int> v(t.size());\n        for(int i=0;i<t.size();i++)\n 
```\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost) {\n        vector<int> v(t.size());\n        for(int i=0;i<t.size();i++)\n        {\n            v[i]=abs(t[i]-s[i]);\n        }\n        int ans=0;\n        int i=0;\n        int j=0;\n        int k=maxCost;\n        while(i<t.size())\n        {\n            k-=v[i];\n            while(k<0)\n            {\n                k+=v[j];\n                j++;\n            }\n            ans=max(ans,i-j+1);\n            i++;\n        }\n        return ans;\n    }\n};\n```
[]