171. Excel Sheet Column Number--LeetCode Record
Related to question Excel Sheet Column Title
Given a column title as appear in an Excel sheet, return its corresponding column number.
For example:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28
class Solution {
func titleToNumber(s: String) -> Int {
var sum:Int = 0
var basic:Int = 1
for (index, ch) in String(s).unicodeScalars.enumerate().reverse() {
let chInt = Int(ch.value) - 64
sum += basic * chInt
basic *= 26
}
return sum
}
}
TestCase
"A"
"AB"
"BA"
"ABC"
"CAB"
相關文章
- Excel Sheet Column Number Excel表列序號Excel
- Excel Sheet Column Title Excel表列名稱Excel
- Leetcode 168. Excel Sheet Column TitleLeetCodeExcel
- leetcode:171. Excel表列序號LeetCodeExcel
- 用Pandas讀寫Excel檔案-輸出單sheet和多sheetExcel
- Python合併多個Excel檔案中的指定sheetPythonExcel
- fortune-sheet: 功能豐富的ReactJS線上Excel庫ReactJSExcel
- 多個報表匯出到一個 excel 的多 sheet 頁Excel
- web 端如何像 excel 裡的多 sheet 方式呈現資料WebExcel
- 同一excel檔案中不同sheet間alt+tab切換Excel
- 高效能javascript開源線上excel:x-sheet初體驗JavaScriptExcel
- 讀取excel某表的sheet1的前5行,寫入的第二個表的sheet1的前5行Excel
- poi操作excel,複製sheet,複製行,複製單元格,複製styleExcel
- 將多個實體類集合寫入同一個 Excel 檔案的不同 Sheet 頁Excel
- 多個excel檔案合併到一個檔案中的多個sheet表中Excel
- react-recordReact
- Active Record Associations
- screen-record
- Swift 4 Cheat Sheet AdvancedSwift
- Axios 作弊表(Cheat Sheet)iOS
- ES6+ ---- record
- Daily record-SeptemberAI
- Learn and Record12
- Camera List Record - 120
- OGG-01163 Bad column length (32) specified for column in table
- 關於EasyExcel的資料匯入和單sheet和多sheet匯出Excel
- Git Cheat Sheet 中文版Git
- ChatGPT Prompting Cheat Sheet備忘ChatGPT
- 實戰 Java 16 值型別 Record - 2. Record 的基本用法Java型別
- Travel Notes-Record mood
- Homework record-Simple sorting
- Index column size too large. The maximum column size is 767 bytes.Index
- [20200904]12c invisible column impdp segment_column_id.txt
- Sorting arrays in NumPy by column
- data too long for column
- CSS column-gapCSS
- CSS column-ruleCSS
- CSS column-widthCSS
- CSS column-spanCSS