Easy approach||Best Solution
Intuition\nSimple intuition was to form a vector to store individual cost of each characters of string and then simply apply sliding window to find largest suba
# Intuition\nSimple intuition was to form a vector to store individual cost of each characters of string and then simply apply sliding window to find largest subarray\n\n# Approach\n1) vector to store abs(s[i]-t[i]);\n2) sliding window (;D)\n\n# Complexity\n- Time complexity: O(n)\n\n- Space complexity:O(n)\n\n# Code\n```\nclass Solution {\npublic:\n\n/*Don\'t get scared from the below function .Incase u r not getting\nwatch youtube tutorial on sliding window and with simple logic u \nwill be able to solve on your own and please upvote :_; */\nint largestSubarraySumLessThan(vector<int>& nums, int target) {\n    int n = nums.size();\n    int start = 0, end = 0, sum = 0;\n    int maxLength = 0;\n\n    while (end < n) {\n        sum += nums[end];\n        \n        while (sum > target && start <= end) {\n            sum -= nums[start];\n            start++;\n        }\n\n        maxLength = max(maxLength, end - start + 1);\n        end++;\n    }\n\n    return maxLength;\n}\n    int equalSubstring(string s, string t, int maxCost) {\n        int N=s.size();\n        vector<int>vec(N);\n        for(int i=0;i<s.size();i++){\n            vec[i]=abs(s[i]-t[i]);\n        }\n        int ans=largestSubarraySumLessThan(vec, maxCost) ;\n\n       return ans; // and please upvote\n    }\n};\n```
['C++']