Back to QuestionsPractice with This Question
Shortest Distance to Target Color (Preprocessing)
96.6K views•Asked at LinkedIn•
Medium
Question Explain
Given an array of colors and a list of queries (index, color), find the shortest distance from the given index to the target color. Preprocessing with maps or arrays is key.
Start Trying This Question Simulation
Practice answering orally or with text to get instant AI feedback.