AI Interview Prep is optimized for larger screens
Please open this on a laptop or desktop (1024px and wider) to use the full editor, whiteboard, and AI coaching surface.
Understand the problem
Restate the problem precisely. Interviewers reward candidates who pause, define the contract, and name the guarantees before coding.
In English, we have a concept called *root*, which can be followed by some other word to form another longer word — let's call this word *successor*. For example, when the *root* `"an"` is followed by the *successor* word `"other"`, we can form a new word `"another"`. Given a `dictionary` consisting of many roots and a `sentence` consisting of words separated by spaces, replace all the successors in the sentence with the root forming it. If a successor can be replaced by more than one root, replace it with the root that has the shortest length. Return the sentence after the replacement.
Once you've drafted a response, click Submit for AI review and a senior engineer will critique your reasoning.