62: Shortest distance to the character
Given a lower case string and target character, find out the shortest distance for each character in the given string to target character
Note: the
targetcharacteralwaysexists in the givenstring
Example 1
Input: word = "abcade", target = a
Output: [0, 1, 1, 0, 1, 2]
Example 2
Input: word = "aaa", target = a
Output: [0, 0, 0]