C++ Subarrray Sum Very Easy to Understand. O(N)
\nWe can visualise this problem as we have to maximise the length of the substring we can change in string a  to string b such that it never exceeds maximum_cos
\nWe can visualise this problem as we have to maximise the length of the substring we can change in string a  to string b such that it never exceeds maximum_cost.\n\nIt is like having a **Maximum Size Subarray Sum with sum less than k.**\n\nAlgorithm\n1. For each index (0 to n) , take absolute difference of string s and t at index i. and increase our cost\n\t\t\t**cost = cost + abs(s[i] - t[i]);**\t\t\t\n2. Till cost is greater than maximumCost, Just Take a counter at index j = 0, and till i increment j and decrease the cost difference at that index j.\n3. Take the maximum of (i - j + 1).\n\n```\nclass Solution {\npublic:\n    int equalSubstring(string s, string t, int maxCost) {\n        \n      int i = 0, j =0, cost = 0, maxm = INT_MIN;\n      \n      for(i = 0; i < s.size(); i++)\n      {\n        cost += abs(s[i] - t[i]);\n        \n        if(cost > maxCost) \n        {\n          while(j <= i and cost > maxCost)\n          {\n            int prevCost = abs(s[j] - t[j]);\n            cost = cost - prevCost;\n            j++;\n          }\n        }\n        \n        maxm = max(maxm, i - j + 1);\n      }\n      return (maxm == INT_MIN) ? 0 : maxm;\n    }\n};\n```
[]