#include <leetcode.h>
|
static string | decodeCiphertext (string encodedText, int rows) |
|
static string | rtrim (string &s) |
| 去除字符串右边的空白符 [https://blog.csdn.net/tiandyoin/article/details/81508445] 更多...
|
|
◆ decodeCiphertext()
string leetcode::decode_the_slanted_ciphertext::Solution::decodeCiphertext |
( |
string |
encodedText, |
|
|
int |
rows |
|
) |
| |
|
static |
在文件 leetcode.cpp 第 808 行定义.
809 if(encodedText.empty()) {
812 const int columns = encodedText.length() / rows;
813 auto *
const table =
new char *[rows];
814 for(
int i = 0; i < rows; i++) {
815 table[i] =
new char[columns - rows + 2];
816 for(
int j = i; j - i < columns - rows + 2; j++) {
817 if(i * columns + j < encodedText.length()) {
818 table[i][j - i] = encodedText[i * columns + j];
820 table[i][j - i] =
' ';
824 auto oss = ostringstream();
825 for(
int j = 0; j < columns - rows + 2; j++) {
826 for(
int i = 0; i < rows; i++) {
830 string ans = oss.str();
831 for(
int i = 0; i < rows; i++) {
static string rtrim(string &s)
去除字符串右边的空白符
引用了 rtrim().
被这些函数引用 leetcode::decode_the_slanted_ciphertext::TEST().
◆ rtrim()
string leetcode::decode_the_slanted_ciphertext::Solution::rtrim |
( |
string & |
s | ) |
|
|
static |
去除字符串右边的空白符 [https://blog.csdn.net/tiandyoin/article/details/81508445]
- 作者
- tiandyoin
- 参数
-
- 返回
- 去除了右边空白符的字符串
在文件 leetcode.cpp 第 838 行定义.
839 for(
int i = s.length() - 1; i >= 0; i--) {
841 string ans = s.substr(0, i + 1);
被这些函数引用 decodeCiphertext().
该类的文档由以下文件生成: