mirror of
https://gitee.com/coder-xiaomo/leetcode-problemset
synced 2025-01-11 02:58:13 +08:00
46 lines
905 B
HTML
46 lines
905 B
HTML
<p>给你一个字符串 <code>columnTitle</code> ,表示 Excel 表格中的列名称。返回 <em>该列名称对应的列序号</em> 。</p>
|
|
|
|
<p>例如:</p>
|
|
|
|
<pre>
|
|
A -> 1
|
|
B -> 2
|
|
C -> 3
|
|
...
|
|
Z -> 26
|
|
AA -> 27
|
|
AB -> 28
|
|
...</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>示例 1:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入:</strong> columnTitle = "A"
|
|
<strong>输出:</strong> 1
|
|
</pre>
|
|
|
|
<p><strong>示例 2:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入: </strong>columnTitle = "AB"
|
|
<strong>输出:</strong> 28
|
|
</pre>
|
|
|
|
<p><strong>示例 3:</strong></p>
|
|
|
|
<pre>
|
|
<strong>输入: </strong>columnTitle = "ZY"
|
|
<strong>输出:</strong> 701</pre>
|
|
|
|
<p> </p>
|
|
|
|
<p><strong>提示:</strong></p>
|
|
|
|
<ul>
|
|
<li><code>1 <= columnTitle.length <= 7</code></li>
|
|
<li><code>columnTitle</code> 仅由大写英文组成</li>
|
|
<li><code>columnTitle</code> 在范围 <code>["A", "FXSHRXW"]</code> 内</li>
|
|
</ul>
|