Easy Java Solution || Beats 98% of Java Users . 
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```java []
class Solution {
    public int equalSubstring(String s, String t, int maxCost) {
        int n = s.length() ; 
        int[] costs = new int[n] ; 
        for( int i=0 ; i<n ; ++i ){
            costs[i] = Math.abs( s.charAt(i) - t.charAt(i) ) ; 
        }
        int rs = 0 ; 
        int start = 0 ; 
        int curr = 0 ; 
        for( int i=0 ; i<n ; ++i ){
            curr += costs[i] ; 
            while( curr > maxCost ){
                 curr -= costs[ start++ ] ; 
            }
            rs = Math.max( rs , i - start + 1 ) ;
        }
        return rs ;
    }
}
```
['String', 'Sliding Window', 'Prefix Sum', 'Java']