Equal Substring Budget
You are given two strings s and t of the same length and an integer maxCost.
You can change each character s[i] to t[i] at a cost equal to |s[i] - t[i]| (the absolute difference of their ASCII values).
Return the length of the longest contiguous substring of s that can be changed to match the corresponding substring of t without exceeding maxCost.
Examples
Input: [1,2,3]
Output: 0
Input: [1,2,3]
Output: 0
Hints
Think of the cost difference array where `diff[i] = |s[i] - t[i]|`. The problem reduces to finding the longest subarray whose sum does not exceed `maxCost`.
When the sum of differences in a window exceeds the budget, sliding the left boundary forward is the only way to bring it back under — every element contributes non-negative cost.
You never need to decrease the window once its sum is within budget; only shrink when the sum overflows. This suggests a linear pass with an expanding window.
Equal Substring Budget
You are given two strings `s` and `t` of the same length and an integer `maxCost`.