JAVA Solution Explained in HINDI
https://youtu.be/h__hozHfOy0\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote 
https://youtu.be/h__hozHfOy0\n\nFor explanation, please watch the above video and do like, share and subscribe the channel. \u2764\uFE0F Also, please do upvote the solution if you liked it.\n\n# Subscribe:- [ReelCoding](https://www.youtube.com/@reelcoding?sub_confirmation=1)\n\nSubscribe Goal:- 400\nCurrent Subscriber:- 395\n\n# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(n)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\n    public int equalSubstring(String s, String t, int maxCost) {\n        int n = s.length();\n        int i = 0, j = 0, ans = 0, curCost = 0;\n\n        while (j < n) {\n            curCost += Math.abs(t.charAt(j) - s.charAt(j));\n            while (i < n && curCost > maxCost) {\n                curCost -= Math.abs(t.charAt(i) - s.charAt(i));\n                i++;\n            }\n            ans = Math.max(ans, j - i + 1);\n            j++;\n        }\n\n        return ans;\n    }\n}\n```
['Java']