从前向后记录空格数目,从后向前替换空格 class Solution { public: void replaceSpace(char *str,int length) { // edge case if(str == nullptr || length == 0) return; // 统计空格数量 int count = 0; for(int i=0; i<length; i++){ if(str[i] == ' ') ...