Shortest Distance to a Character
Given a stringS
and a characterC
, return an array of integers representing the shortest distance from the characterC
in the string.
Example 1:
Note:
分析
左右各遍历一遍,得到min distance
Last updated
Given a stringS
and a characterC
, return an array of integers representing the shortest distance from the characterC
in the string.
Example 1:
Note:
分析
左右各遍历一遍,得到min distance
Last updated