problemscpp
A collection of my answers to algorithm problems in c++.
静态 Public 成员函数 | 所有成员列表
leetcode::replace_all_s_to_avoid_consecutive_repeating_characters::Solution类 参考

#include <leetcode.h>

静态 Public 成员函数

static string modifyString (string s)
 

详细描述

在文件 leetcode.h248 行定义.

成员函数说明

◆ modifyString()

string leetcode::replace_all_s_to_avoid_consecutive_repeating_characters::Solution::modifyString ( string  s)
static

在文件 leetcode.cpp540 行定义.

540 {
541 for(int i = 0; i < s.size(); i++) {
542 if(s[i] == '?') {
543 for(char ch = 'a'; ch < 'z' + 1; ch++) {
544 if(0 <= i - 1 && s[i - 1] == ch) {
545 continue;
546 }
547 if(i + 1 < s.size() && s[i + 1] == ch) {
548 continue;
549 }
550 s[i] = ch;
551 break;
552 }
553 }
554 }
555 return s;
556 }

被这些函数引用 leetcode::replace_all_s_to_avoid_consecutive_repeating_characters::TEST().


该类的文档由以下文件生成: