Medium
Excel Sheet Column Number
Medium
0 submissions
25 coins
+100 XP
Math
String
Problem Description
Given a string `columnTitle` that represents the column title as appears in an Excel sheet, return its corresponding column number.
For example:
```
A -> 1
B -> 2
Z -> 26
AA -> 27
AB -> 28
...
```
**Example 1:**
```
Input: columnTitle = "A"
Output: 1
```
**Example 2:**
```
Input: columnTitle = "AB"
Output: 28
Explanation: A * 26 + B = 1 * 26 + 2 = 28
```
**Example 3:**
```
Input: columnTitle = "ZY"
Output: 701
Explanation: Z * 26 + Y = 26 * 26 + 25 = 701
```
Constraints
- `1 <= columnTitle.length <= 7`
- `columnTitle` consists only of uppercase English letters.
- `columnTitle` is in the range `["A", "FXSHRXW"]`.
Need help?
Connect with expert programmers for real-time collaborative coding, video meetings, and whiteboard sessions via CodeConnect.
Video Call
Whiteboard
Live Coding
Screen Share