#include <leetcode.h>
|
static void | dfs (const vector< string > ¤t, const string &s, vector< vector< string > > &ans, int start, int cursor) |
|
static bool | is_palindromic (const string &s, int start, int end) |
|
static vector< vector< string > > | partition (const string &s) |
|
◆ dfs()
void leetcode::palindrome_partitioning::Solution::dfs |
( |
const vector< string > & | current, |
|
|
const string & | s, |
|
|
vector< vector< string > > & | ans, |
|
|
int | start, |
|
|
int | cursor ) |
|
static |
在文件 leetcode.cpp 第 8858 行定义.
8858 {
8859 if(cursor == s.length() - 1 &&
is_palindromic(s, start, cursor)) {
8860 ans.emplace_back(current);
8861 ans.back().emplace_back(s.substr(start, cursor - start + 1));
8862 return;
8863 }
8864 if(cursor >= s.length() - 1 || start >= s.length()) {
8865 return;
8866 }
8868 vector next = current;
8869 next.emplace_back(s.substr(start, cursor - start + 1));
8870 dfs(next, s, ans, cursor + 1, cursor + 1);
8871 }
8872 dfs(current, s, ans, start, cursor + 1);
8873 }
vector< vector< int > > ans
static void dfs(const vector< string > ¤t, const string &s, vector< vector< string > > &ans, int start, int cursor)
static bool is_palindromic(const string &s, int start, int end)
引用了 dfs() , 以及 is_palindromic().
被这些函数引用 dfs() , 以及 partition().
◆ is_palindromic()
bool leetcode::palindrome_partitioning::Solution::is_palindromic |
( |
const string & | s, |
|
|
int | start, |
|
|
int | end ) |
|
static |
在文件 leetcode.cpp 第 8849 行定义.
8849 {
8850 for(int i = start, j = end; i < j; i++, j--) {
8851 if(s[i] != s[j]) {
8852 return false;
8853 }
8854 }
8855 return true;
8856 }
被这些函数引用 dfs().
◆ partition()
vector< vector< string > > leetcode::palindrome_partitioning::Solution::partition |
( |
const string & | s | ) |
|
|
static |
该类的文档由以下文件生成: