//url:https://leetcode.com/problems/shortest-distance-to-a-character/description/
//最短的距离,取决于该位置左右两边目标C位置的距离
class Solution {
public:
vector shortestToChar(string S, char C) {
vector result;
int firstMeet=-1;
int lastMeet=-1;
for(int i=0;i
- 本文作者: royalchen
- 本文链接: http://www.royalchen.com/2018/07/23/leetcode-821-shortest-distance-to-a-character/
- 版权声明: 本博客所有文章除特别声明外,均采用 MIT 许可协议。转载请注明出处!