Python || Easy Clean Solution. Sliding Window.
Complexity\n- Time complexity: O(n)\n Add your time complexity here, e.g. O(n) \n\n- Space complexity: O(1)\n Add your space complexity here, e.g. O(n) \n\n# Co
# Complexity\n- Time complexity: O(n)\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity: O(1)\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution:\n    def equalSubstring(self, s: str, t: str, maxCost: int) -> int:\n        left = ans = curr = 0\n        for i in range(len(s)):\n            curr += abs(ord(s[i]) - ord(t[i]))\n            while curr > maxCost:\n                curr -= abs(ord(s[left]) - ord(t[left]))\n                left += 1\n            ans = max(ans, i - left + 1)\n        return ans\n```\n![catty.png](https://assets.leetcode.com/users/images/3d1b0651-e8aa-4b87-86b9-53e2e873f76d_1694092487.3318822.png)\n
['String', 'Sliding Window', 'Python3']