#include <leetcode.h>
◆ patternMatching()
bool leetcode::pattern_matching_lcci::Solution::patternMatching |
( |
const string & |
pattern, |
|
|
const string & |
value |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 1783 行定义.
1786 for(
const char ch: pattern) {
1793 if(a_count == 0 || b_count == 0) {
1797 if(value.length() % a_count != 0) {
1800 size = value.length() / a_count;
1803 if(value.length() % b_count != 0) {
1806 size = value.length() / b_count;
1809 const string str = value.substr(0, size);
1810 for(
int i = 0; i < count; i++) {
1811 auto s = value.substr(i * size, size);
1818 for(
int a_size = 0; a_size <= value.length() / a_count; a_size++) {
1821 if((value.length() - a_size * a_count) % b_count == 0) {
1822 const int b_size = (value.length() - a_size * a_count) / b_count;
1823 string value_local = value;
1824 for(
const char ch: pattern) {
1826 string a_local = value_local.substr(0, a_size);
1829 }
else if(a_local != a) {
1832 value_local = value_local.substr(a_size);
1834 string b_local = value_local.substr(0, b_size);
1837 }
else if(b_local != b) {
1840 value_local = value_local.substr(b_size);
被这些函数引用 leetcode::pattern_matching_lcci::TEST().
该类的文档由以下文件生成: