โ† Expedia questions

Shortest distance to a target character in a string

Filed under Expedia

Given a string s and a character c that occurs in s, return an array of integers representing the shortest distance from each index in s to the closest occurrence of the character c.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related Expedia questions

Collected from public candidate posts and coding forums. Updated Nov 2026.