> For the complete documentation index, see [llms.txt](https://liuyang89116.gitbook.io/my-leetcode-book/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liuyang89116.gitbook.io/my-leetcode-book/post_chapter_2_math/problem-168-excel-sheet-column-title.md).

# Problem 168. Excel Sheet Column Title

> <https://leetcode.com/problems/excel-sheet-column-title/#/description>

## 思路

* 这道题类似于 get 一个数字的每一位
* 需要注意的是，insert 的时候是从个位向高位走的

```java
public class Solution {
    public String convertToTitle(int n) {
        StringBuilder sb = new StringBuilder();
        while (n > 0) {
            n--;
            sb.insert(0, (char)('A' + n % 26));
            n /= 26;
        }

        return sb.toString();
    }
}
```
