Back to QuestionsPractice with This Question
Shortest Distance to Character (Queue)
124.4K views•Asked at Netflix•
Easy
Question Explain
Given a string $S$ and a character $C$, return an array of integers representing the shortest distance from each character in $S$ to the character $C$. Use a two-pass linear scan or BFS.
Start Trying This Question Simulation
Practice answering orally or with text to get instant AI feedback.