1208. Get Equal Substrings Within Budget #255
Unanswered
mah-shamim
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
You are given two strings
s
andt
of the same length and an integermaxCost
.You want to change
s
tot
. Changing theith
character of s to ith character oft
costs|s[i] - t[i]|
(i.e., the absolute difference between the ASCII values of the characters).Return the maximum length of a substring of
s
that can be changed to be the same as the corresponding substring oft
with a cost less than or equal tomaxCost
. If there is no substring froms
that can be changed to its corresponding substring fromt
, return0
.Example 1:
That costs 3, so the maximum length is 3.
Example 2:
Example 3:
Constraints:
1 <= s.length <= 105
t.length == s.length
0 <= maxCost <= 106
s
andt
consist of only lowercase English letters.Beta Was this translation helpful? Give feedback.
All reactions