Skip to content

Latest commit

 

History

History

get-equal-substrings-within-budget

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

Get Equal Substrings Within Budget

LeetCode #: 1208

Difficulty: Medium

Topics: Array, sliding window.

Explanation

First, we need to understand that this problem deals with the differences between the characters in s and t, rather than the actual characters.

To get the maximum length of substring with a cost less than or equal to maxCost, we use the sliding window technique on the differences to get the maximum length.

Complexity Analysis

Assume n is the number of characters in s.

Time complexity: O(n)

Space complexity: O(1)