mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-09-05 15:31:43 +08:00
update
This commit is contained in:
45
leetcode/problem/excel-sheet-column-number.html
Normal file
45
leetcode/problem/excel-sheet-column-number.html
Normal file
@@ -0,0 +1,45 @@
|
||||
<p>Given a string <code>columnTitle</code> that represents the column title as appear in an Excel sheet, return <em>its corresponding column number</em>.</p>
|
||||
|
||||
<p>For example:</p>
|
||||
|
||||
<pre>
|
||||
A -> 1
|
||||
B -> 2
|
||||
C -> 3
|
||||
...
|
||||
Z -> 26
|
||||
AA -> 27
|
||||
AB -> 28
|
||||
...
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Example 1:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> columnTitle = "A"
|
||||
<strong>Output:</strong> 1
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 2:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> columnTitle = "AB"
|
||||
<strong>Output:</strong> 28
|
||||
</pre>
|
||||
|
||||
<p><strong>Example 3:</strong></p>
|
||||
|
||||
<pre>
|
||||
<strong>Input:</strong> columnTitle = "ZY"
|
||||
<strong>Output:</strong> 701
|
||||
</pre>
|
||||
|
||||
<p> </p>
|
||||
<p><strong>Constraints:</strong></p>
|
||||
|
||||
<ul>
|
||||
<li><code>1 <= columnTitle.length <= 7</code></li>
|
||||
<li><code>columnTitle</code> consists only of uppercase English letters.</li>
|
||||
<li><code>columnTitle</code> is in the range <code>["A", "FXSHRXW"]</code>.</li>
|
||||
</ul>
|
Reference in New Issue
Block a user