Shortest Distance to Target Character
Asked at Snowflake · Coding Questions · Difficulty: Easy
Given a string `s` of length `n` and a target character `target`, return an integer array `ans` of length `n`, where `ans[i]` is the absolute distance from index `i` to the nearest occurrence of `target` in `s`.
Loading the problem…
More Snowflake interview questions
- Design a Distributed Job Scheduler with Cron, Pause, Resume
- Design an ACL Authorization Service
- Design an S3-Style Blob Store with Deduplication
- SQL: Project Duration & Budget per Employee
- Cross-Platform Client Logging Library
- Design a Quota System