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

#include <leetcode.h>

静态 Public 成员函数

static string convertToTitle (int columnNumber)
 

详细描述

在文件 leetcode.h106 行定义.

成员函数说明

◆ convertToTitle()

string leetcode::excel_sheet_column_title::Solution::convertToTitle ( int  columnNumber)
static

在文件 leetcode.cpp119 行定义.

119 {
120 auto ans = string();
121 bool round = false;
122 while(columnNumber != 0) {
123 char ch = 0;
124 if(round) {
125 ch = static_cast<char>(columnNumber % 26 + 63);
126 round = false;
127 } else {
128 ch = static_cast<char>(columnNumber % 26 + 64);
129 }
130 if(ch == '@' && columnNumber >= 26) {
131 ch = 'Z';
132 round = true;
133 } else if(ch == '?' && columnNumber >= 26) {
134 ch = 'Y';
135 round = true;
136 }
137 if('A' <= ch && ch <= 'Z') {
138 ans.insert(0, 1, ch);
139 }
140 columnNumber /= 26;
141 }
142 return ans;
143 }

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


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