原题

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. 2019牛客暑期多校训练营(第一场)A Equivalent Prefixes

    传送门 题意: 先输入一个n,代表两个数组里面都有n个数,然后让你从中找到一个p<=n,使其满足(1<=l<=r<=p<=n)可以让在(l,r)这个区间内在两个数组中的的 ...

  2. 2018-2019 ACM-ICPC Brazil Subregional Programming Contest PART (10/13)

    $$2018-2019 ACM-ICPC Brazil Subregional Programming Contest$$ \(A.Slackline\ Adventure\) \(B.Marbles ...

  3. Codeforces Round #655 (Div. 2) C. Omkar and Baseball

    题目链接:https://codeforces.com/contest/1372/problem/C 题意 给出一个大小为 $n$ 的排列,每次操作可以选取一个连续子数组任意排列其中的元素,要求每个元 ...

  4. Codeforces Round #614 (Div. 1) A. NEKO's Maze Game (思维,模拟)

    题意:有一个\(2\)X\(n\)的矩阵,你想从\((1,1)\)走到\((2,n)\),每次可以向上下左右四个方向走,但在某些时间段某个点会被堵住,如果已经被堵住,那么即恢复正常,每次对某个点操作, ...

  5. nginx+lua实现灰度发布/waf防火墙

    nginx+lua 实现灰度发布 waf防火墙 课程链接:[课程]Nginx 与 Lua 实现灰度发布与 WAF 防火墙(完)_哔哩哔哩 (゜-゜)つロ 干杯~-bilibili 参考博客 Nginx ...

  6. Zabbix 微信监控报警

    Zabbix-Server 设置 # 使脚本目录生效 [root@zabbix ~]# grep 'script' /etc/zabbix/zabbix_server.conf # AlertScri ...

  7. 宝塔面板&FLASK&centos 7.2 &腾讯云 配置网站出现的若干问题

    1.解决跨域问题&&中文显示问题 from flask import Flask, url_for, request, render_template, redirect from f ...

  8. haut-1282 ykc想吃好吃的

    1282: ykc想吃好吃的 时间限制: 1 秒  内存限制: 128 MB提交: 706  解决: 89提交 状态 题目描述 一天,ykc在学校闲的无聊,于是决定上街买点吃的,ykc很懒,本来就不是 ...

  9. μC/OS-III---I笔记7---消息队列

    消息队列 任务之间仅仅靠信号量进行"沟通"是不够的,信号量可以标志事件的发生,却无法传递更多的数据,在需要任务间的数据信息传递时就绪要用到消息队列,传统我们一般在前后太系统中都是通 ...

  10. zsh terminal set infinity scroll height

    zsh terminal set infinity scroll height zsh Terminal 开启无限滚动 https://stackoverflow.com/questions/2761 ...