Product
Pricing
Blog
Forum
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
AI Insights
Quick Summary
Locate every non-overlapping instance of a target substring inside a source string.
Substitute each matched segment with a replacement string.
Implement the replacement logic manually without using built-in string methods.
What This Tests
Efficient string pattern matching techniques
Linear traversal and boundary condition handling
Result construction without intermediate slicing
Algorithmic complexity trade-offs
Common Patterns
Two Pointers
String Matching
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Report
Report seen similar question in interview
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
python
Auto
Debug
Run
Submit
Test Cases
Input
Output
Expected