剑指OFFER----面试题05.替换空格

Posted clown9804

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了剑指OFFER----面试题05.替换空格相关的知识,希望对你有一定的参考价值。

链接:https://leetcode-cn.com/problems/ti-huan-kong-ge-lcof/

 

代码:

class Solution {
public:
    string replaceSpace(string s) {
        string res;
        for (auto x: s) {
            if (x ==  )
                res += "%20";
            else
                res += x;
        }
        return res;
    }
};

 

以上是关于剑指OFFER----面试题05.替换空格的主要内容,如果未能解决你的问题,请参考以下文章