-
168. Excel Sheet Column Title릿코드(LEETCODE) 2020. 2. 6. 16:14반응형
https://leetcode.com/problems/excel-sheet-column-title/
class Solution { public: string convertToTitle(int n) { string s; while (n) { s.push_back('A' + (n - 1) % 26); n = (n - 1) / 26; } reverse(s.begin(), s.end()); return s; } };
반응형'릿코드(LEETCODE)' 카테고리의 다른 글
383. Ransom Note (2) 2020.02.07 171. Excel Sheet Column Number (0) 2020.02.06 581. Shortest Unsorted Continuous Subarray (0) 2020.02.05 709. To Lower Case (0) 2020.02.03 1323. Maximum 69 Number (0) 2020.02.03