Skip to content

Commit

Permalink
171
Browse files Browse the repository at this point in the history
  • Loading branch information
lzl124631x committed Feb 22, 2022
1 parent c0e2fec commit 095e654
Showing 1 changed file with 21 additions and 16 deletions.
37 changes: 21 additions & 16 deletions leetcode/171. Excel Sheet Column Number/README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,53 @@
# [171. Excel Sheet Column Number (Easy)](https://leetcode.com/problems/excel-sheet-column-number/)

<p>Given a column title as appear in an Excel sheet, return its corresponding column number.</p>
<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 -&gt; 1
B -&gt; 2
C -&gt; 3
...
Z -&gt; 26
AA -&gt; 27
AB -&gt; 28
...
<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>Example 1:</strong></p>

<pre><strong>Input:</strong> "A"
<pre><strong>Input:</strong> columnTitle = "A"
<strong>Output:</strong> 1
</pre>

<p><strong>Example 2:</strong></p>

<pre><strong>Input: </strong>"AB"
<pre><strong>Input:</strong> columnTitle = "AB"
<strong>Output:</strong> 28
</pre>

<p><strong>Example 3:</strong></p>

<pre><strong>Input: </strong>"ZY"
<pre><strong>Input:</strong> columnTitle = "ZY"
<strong>Output:</strong> 701
</pre>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>

<ul>
<li><code>1 &lt;= s.length &lt;= 7</code></li>
<li><code>s</code> consists only of uppercase English letters.</li>
<li><code>s</code> is between "A" and "FXSHRXW".</li>
<li><code>1 &lt;= columnTitle.length &lt;= 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>


**Companies**:
[Microsoft](https://leetcode.com/company/microsoft), [Bloomberg](https://leetcode.com/company/bloomberg)

**Related Topics**:
[Math](https://leetcode.com/tag/math/)
[Math](https://leetcode.com/tag/math/), [String](https://leetcode.com/tag/string/)

**Similar Questions**:
* [Excel Sheet Column Title (Easy)](https://leetcode.com/problems/excel-sheet-column-title/)
Expand Down

0 comments on commit 095e654

Please sign in to comment.