当前位置:网站首页>Excel sheet column title for leetcode Title Resolution
Excel sheet column title for leetcode Title Resolution
2022-06-23 05:50:00 【ruochen】
Given a positive integer, return its corresponding column title as appear in an Excel sheet.
For example:
1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> AB
public String convertToTitle(int n) {
if (n < 27) {
return (char) ('A' + (n - 1)) + "";
}
if (n % 26 == 0) {
return convertToTitle(n / 26 - 1) + 'Z';
}
return convertToTitle(n / 26) + convertToTitle(n % 26);
}边栏推荐
- Yingjixin ip5566 with type-C port 3A charging and discharging fast charging mobile power supply 5W wireless charging in one SOC
- Heimdall database proxy scale out 20 times
- C primer plus學習筆記 —— 2、常量與格式化IO(輸入/輸出)
- FS2119A同步升压IC输出3.3V和FS2119B同步升压IC输出5V
- opencv显示图像
- Centos7 installation of postgresql8.2.15 and creation of stored procedures
- Real MySQL interview questions (25) -- common group comparison scenarios
- 高等数学(第七版)同济大学 习题1-9 个人解答
- 新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!
- 数字藏品赋能实体产业释放了哪些利好?
猜你喜欢

Kotlin android简单Activity跳转、handler和thread简单配合使用

Wechat applet: production and generation of love guarantee

Wechat applet: unfashionable love talk

阿里云对象存储oss+picgo+typora实现构建图床

新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!

FS2119A同步升压IC输出3.3V和FS2119B同步升压IC输出5V

Centos7 installation of postgresql8.2.15 and creation of stored procedures

ArcTime 制作中英文字幕视频

三项最高级认证,两项创新技术、两大优秀案例,阿里云亮相云原生产业大会

Leetcode 797: all possible paths
随机推荐
数字化工厂建设可划分为三个方面
visdom画多条动态损失曲线
树莓派assert初步使用练习
C prime plus notes d'apprentissage - 2, constantes et formatage io (I / o)
制造业数字化转型存在问题及原因分析
Lottery DDD code
Wechat applet: unfashionable love talk
PAT 乙等 1010 C语言
新课上线 | 每次 5 分钟,轻松玩转阿里云容器服务!
android Handler内存泄露 kotlin内存泄露处理
数字藏品火热背后需要强大的技术团队支持 北方技术团队
技能自检 | 想当测试Leader,这6项技能你会吗?
Jsonfield annotation in fastjson
Wechat applet: elderly blessing short video
The performance of nonstandard sprintf code in different platforms
Wechat applet: a new interesting test
What benefits have digital collections enabled the real industry to release?
PAT 乙等 1018 C语言
True MySQL interview question (21) - Finance - overdue loan
常用的无线充发射IC芯片