Leetcode 168 Excel Sheet Column Title

来源:互联网 发布:linux python模块 编辑:程序博客网 时间:2024/06/04 18:42

Leetcode 168 Excel Sheet Column Title

#include <string>using namespace std;class Solution {public:    string convertToTitle(int n) {    string title;    while(n != 0)    {       int temp = (n - 1) % 26;       title = (char)(temp + 'A') + title;       n = (n-1)/26;    }    return title;    }};
原创粉丝点击