#include <leetcode.h>
|
static string | convert (string s, int numRows) |
|
◆ convert()
string leetcode::zigzag_conversion::Solution::convert |
( |
string |
s, |
|
|
int |
numRows |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 3707 行定义.
3711 auto oss = ostringstream();
3712 auto *m =
new char *[numRows];
3713 for(
int i = 0; i < numRows; i++) {
3714 m[i] =
new char[s.length()];
3715 memset(m[i],
' ', s.length() *
sizeof(
char));
3720 for(
const char ch: s) {
3721 m[current_x][current_y] = ch;
3722 if(dir && current_x == numRows - 1 || !dir && current_x == 0) {
3732 for(
int i = 0; i < numRows; i++) {
3733 for(
int j = 0; j <= min(current_y, static_cast<int>(s.length() - 1)); j++) {
3734 if(m[i][j] !=
' ') {
3739 for(
int i = 0; i < numRows; i++) {
被这些函数引用 leetcode::zigzag_conversion::TEST().
该类的文档由以下文件生成: