var titleToNumber = function (s) {
let charCodeBase = 'A'.charCodeAt(0) - 1; // 64
// console.log(charCodeBase);
let number = 0;
const len = s.length;
for (let i = 0; i < len; i++) {
console.log(s.charCodeAt(i));
number += (s.charCodeAt(i) - charCodeBase) * Math.pow(26, len - i - 1);
}
return number;
};
혼자 못 풀었다. 문자열을 조작하는 문제를 더 접해봐야함. 잘 안되더라도 스스로 생각해서 풀기 계속
https://leetcode.com/problems/excel-sheet-column-number/
https://github.com/tTab1204/LeetCode/tree/main/%EC%A3%BC%EC%98%81