Same Substring
Problem Overview
- Find the maximum length of a substring in s that can be changed to match t with total cost <= K.
- Input: two equal-length lowercase strings s and t, and integer K. Output: an int length, or 0 if none.
- Cost per index is the absolute ASCII difference between s[i] and t[i]; sum over the chosen substring must stay within K.
- Domain: text processing and string transformation; a common coding interview problem.
- Source: Salesforce interviews; a frequent interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
