|
1 | 1 | # [171. Excel Sheet Column Number (Easy)](https://leetcode.com/problems/excel-sheet-column-number/)
|
2 | 2 |
|
3 |
| -<p>Given a column title as appear in an Excel sheet, return its corresponding column number.</p> |
| 3 | +<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> |
4 | 4 |
|
5 | 5 | <p>For example:</p>
|
6 | 6 |
|
7 |
| -<pre> A -> 1 |
8 |
| - B -> 2 |
9 |
| - C -> 3 |
10 |
| - ... |
11 |
| - Z -> 26 |
12 |
| - AA -> 27 |
13 |
| - AB -> 28 |
14 |
| - ... |
| 7 | +<pre>A -> 1 |
| 8 | +B -> 2 |
| 9 | +C -> 3 |
| 10 | +... |
| 11 | +Z -> 26 |
| 12 | +AA -> 27 |
| 13 | +AB -> 28 |
| 14 | +... |
15 | 15 | </pre>
|
16 | 16 |
|
| 17 | +<p> </p> |
17 | 18 | <p><strong>Example 1:</strong></p>
|
18 | 19 |
|
19 |
| -<pre><strong>Input:</strong> "A" |
| 20 | +<pre><strong>Input:</strong> columnTitle = "A" |
20 | 21 | <strong>Output:</strong> 1
|
21 | 22 | </pre>
|
22 | 23 |
|
23 | 24 | <p><strong>Example 2:</strong></p>
|
24 | 25 |
|
25 |
| -<pre><strong>Input: </strong>"AB" |
| 26 | +<pre><strong>Input:</strong> columnTitle = "AB" |
26 | 27 | <strong>Output:</strong> 28
|
27 | 28 | </pre>
|
28 | 29 |
|
29 | 30 | <p><strong>Example 3:</strong></p>
|
30 | 31 |
|
31 |
| -<pre><strong>Input: </strong>"ZY" |
| 32 | +<pre><strong>Input:</strong> columnTitle = "ZY" |
32 | 33 | <strong>Output:</strong> 701
|
33 | 34 | </pre>
|
| 35 | + |
34 | 36 | <p> </p>
|
35 | 37 | <p><strong>Constraints:</strong></p>
|
36 | 38 |
|
37 | 39 | <ul>
|
38 |
| - <li><code>1 <= s.length <= 7</code></li> |
39 |
| - <li><code>s</code> consists only of uppercase English letters.</li> |
40 |
| - <li><code>s</code> is between "A" and "FXSHRXW".</li> |
| 40 | + <li><code>1 <= columnTitle.length <= 7</code></li> |
| 41 | + <li><code>columnTitle</code> consists only of uppercase English letters.</li> |
| 42 | + <li><code>columnTitle</code> is in the range <code>["A", "FXSHRXW"]</code>.</li> |
41 | 43 | </ul>
|
42 | 44 |
|
43 | 45 |
|
| 46 | +**Companies**: |
| 47 | +[Microsoft](https://leetcode.com/company/microsoft), [Bloomberg](https://leetcode.com/company/bloomberg) |
| 48 | + |
44 | 49 | **Related Topics**:
|
45 |
| -[Math](https://leetcode.com/tag/math/) |
| 50 | +[Math](https://leetcode.com/tag/math/), [String](https://leetcode.com/tag/string/) |
46 | 51 |
|
47 | 52 | **Similar Questions**:
|
48 | 53 | * [Excel Sheet Column Title (Easy)](https://leetcode.com/problems/excel-sheet-column-title/)
|
|
0 commit comments