Facebook | Phone | Shortest Distance to a Character
Anonymous User
2183

https://leetcode.com/problems/shortest-distance-to-a-character/

Given a String and a character, output the array such that, each character's minimum distance from the given character.

Example:

Input: s = "instagram", c = "a"
Output: [4, 3, 2, 1, 0, 1, 1, 0, 1]
Comments (16)