赞
踩
问题 https://leetcode-cn.com/problems/excel-sheet-column-title/
练习使用JavaScript解答
- /**
- * @param {number} n
- * @return {string}
- */
- var convertToTitle = function(n) {
- var str = [], j;
- while(n>0) {
- --n;
- j = n % 26;
- str.push(String.fromCharCode(j+'A'.charCodeAt()));
- n = Math.floor(n/26);
- }
- return str.reverse().join("");
- };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。