原题

1 class Solution:
2 def convertToTitle(self, n: int) -> str:
3 s = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
4 ans = ''
5 while n > 0:
6 ans += s[(n - 1) % 26]
7 n = (n - 1) // 26
8 return ans[::-1]

力扣168. Excel表列名称的更多相关文章

  1. 刷题-力扣-168. Excel表列名称

    168. Excel表列名称 题目链接 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/excel-sheet-column-title 著作权 ...

  2. LeetCode 168. Excel表列名称(Excel Sheet Column Title)

    168. Excel表列名称 168. Excel Sheet Column Title 题目描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. LeetCode168. Excel S ...

  3. leetcode 实现-168.Excel表列名称

    168.Excel表列名称 描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C … 26 -> Z 27 -&g ...

  4. Java实现 LeetCode 168 Excel表列名称

    168. Excel表列名称 给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -&g ...

  5. LeetCode 168. Excel表列名称(Excel Sheet Column Title)

    题目描述 给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 - ...

  6. [LeetCode] 168. Excel Sheet Column Title 求Excel表列名称

    Given a positive integer, return its corresponding column title as appear in an Excel sheet. For exa ...

  7. 168 Excel Sheet Column Title Excel表列名称

    给定一个正整数,返回它在Excel表中相对应的列名称.示例:    1 -> A    2 -> B    3 -> C    ...    26 -> Z    27 -&g ...

  8. LeetCode168.Excel表列名称

    给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> ...

  9. 【leetcode 简单】第三十九题 Excel表列名称

    给定一个正整数,返回它在 Excel 表中相对应的列名称. 例如, 1 -> A 2 -> B 3 -> C ... 26 -> Z 27 -> AA 28 -> ...

随机推荐

  1. Hbase Java API包括协处理器统计行数

    package com.zy; import java.io.IOException; import org.apache.commons.lang.time.StopWatch; import or ...

  2. java大数函数(附官方文档链接)

    java文档 字段摘要 static BigInteger ONE           BigInteger 的常量 1. static BigInteger TEN           BigInt ...

  3. POJ1142 Smith Numbers 暴力+分解质因子

    题意:题目定义了一个史密斯数,这个数的定义是:一个合数的各个位置上加起来的和等于它的素因数所有位置上的数字加起来的和.比如: 4937775=3∗5∗5∗658374+9+3+7+7+7+5=3+5+ ...

  4. 牛客编程巅峰赛S1第5场 - 青铜&白银 A.凯撒密码(字符串)

    题意:给你一个加密的字符串,以及偏移量,求对应的明文. 题解:根据样例,不难看出模板串是:\(0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopq ...

  5. KafkaConsumer 简析

    使用方式 创建一个 KafkaConsumer 对象订阅主题并开始接收消息: Properties properties = new Properties(); properties.setPrope ...

  6. leetcode 周赛 205 1576-5508-5509-5510

    第四题比较难,看题解用并查集做比较简单,但是我觉得难度在想到用并查集,可能是最近做题少所以想不到吧. 1 替换所有的问号 class Solution { public: string modifyS ...

  7. 鸟哥的linux私房菜——第九章学习(vim编辑器)

    第九章vim编辑器 1.0).vi与vim Linux下文本界面的文书编辑器通常会有常常听到的就有: emacs, pico, nano, joe, 与 vim 等等. vi的优势: 所有的 Unix ...

  8. cccc超级酱油心得

    第一次线下比赛献给了cccc. 大致写写自己心得,比赛前一天晚上日常和室友在宿舍玩到11点多,洗漱上床.睡前突然想起第二天还有比赛,顿时激动加紧张.在床上刷了刷知乎和百度,看几道去年的真题,熬到了12 ...

  9. five86-1 (OpenNetadmin RCE+cp命令提权+crunch生成密码字典)

    Vulnhub-Five86-1 实验环境 kali攻击机ip:192.168.56.116 Five86-1靶机ip:192.168.56.121 知识点及工具 nmap扫描 john爆破 Open ...

  10. for-in循环等

    一.for-in循环 in表示从(字符串.序列等)中一次取值,又称为遍历 其便利对象必须是可迭代对象 语法结构: for 自定义的变量 in 可迭代对象: 循环体 for item in 'Pytho ...