LeetCode MEDIUM 833 Find And Replace in String Summary
Generated by Codex with GPT-5
Quick facts
- Difficulty:
MEDIUM - Problem: Find And Replace in String
- Topics:
Array,Hash Table,String,Sorting
Problem gist
The input is a base string s and three parallel arrays:
indices[i]says where a possible replacement starts.sources[i]says what text must already appear there.targets[i]says what text to write if the source matches.
Every replacement is checked against the original string, not against a partially edited string. That “simultaneous” detail is the core of the problem. If s = "abcd", indices = [0, 2], sources = ["a", "cd"], and targets = ["eee", "ffff"], both checks happen on "abcd", so the answer is "eeebffff".