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

#include <leetcode.h>

静态 Public 成员函数

static string reversePrefix (string word, char ch)
 

详细描述

在文件 leetcode.h865 行定义.

成员函数说明

◆ reversePrefix()

string leetcode::reverse_prefix_of_word::Solution::reversePrefix ( string  word,
char  ch 
)
static

在文件 leetcode.cpp2154 行定义.

2154 {
2155 int i = 0;
2156 for(; i < word.length(); i++) {
2157 if(ch == word[i]) {
2158 break;
2159 }
2160 }
2161 if(i == word.length()) {
2162 return word;
2163 }
2164 string prefix = word.substr(0, i + 1);
2165 const string suffix = word.substr(i + 1);
2166 const auto xiferp = string(prefix.rbegin(), prefix.rend());
2167 return xiferp + suffix;
2168 }

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


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