1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-10 18:48:13 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/Excel 表列序号 [excel-sheet-column-number].html
2022-03-29 12:43:11 +08:00

46 lines
905 B
HTML

<p>给你一个字符串&nbsp;<code>columnTitle</code> ,表示 Excel 表格中的列名称。返回 <em>该列名称对应的列序号</em>&nbsp;</p>
<p>例如:</p>
<pre>
A -&gt; 1
B -&gt; 2
C -&gt; 3
...
Z -&gt; 26
AA -&gt; 27
AB -&gt; 28
...</pre>
<p>&nbsp;</p>
<p><strong>示例 1:</strong></p>
<pre>
<strong>输入:</strong> columnTitle = "A"
<strong>输出:</strong> 1
</pre>
<p><strong>示例&nbsp;2:</strong></p>
<pre>
<strong>输入: </strong>columnTitle = "AB"
<strong>输出:</strong> 28
</pre>
<p><strong>示例&nbsp;3:</strong></p>
<pre>
<strong>输入: </strong>columnTitle = "ZY"
<strong>输出:</strong> 701</pre>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= columnTitle.length &lt;= 7</code></li>
<li><code>columnTitle</code> 仅由大写英文组成</li>
<li><code>columnTitle</code> 在范围 <code>["A", "FXSHRXW"]</code></li>
</ul>