offer
来源:互联网 发布:java 分布式事务 编辑:程序博客网 时间:2024/05/22 06:43
问题描述
解题思路
实现源码
class Solution {public: void replaceSpace(char *str,int length) { char temp[999999]; int i = 0; int j = 0; while(i<length) { if(str[i] != ' ') { temp[j++] = str[i++]; } else { temp[j++] = '%'; temp[j++] = '2'; temp[j++] = '0'; i++; } } strcpy(str,temp); }};