class Solution {
public:
string convertToTitle(int columnNumber) {
string ans;
while(columnNumber >0){
int current=(columnNumber-1)%26;
columnNumber=(columnNumber-1)/26;
char character;
character='A'+current;
ans=character+ans;
}
return ans;
}
};
【DAY6:Leetcode Excel表列名称】
最新推荐文章于 2024-11-14 23:35:31 发布