Excel Sheet Column Number Problem Statement
You are provided with a string STR
representing a column title in an Excel Sheet. Your task is to determine the corresponding column number.
Example:
A typical example includes: A corresponds to 1, B to 2, C to 3, ..., Z to 26, AA to 27, and so on.
Input:
The first line of input contains a single integer T, representing the number of test cases or queries to be executed.
The subsequent T test cases follow.
The first and only line of each test case contains a string STR denoting the column title. It is guaranteed that all characters are uppercase English alphabets.
Output:
For each test case, output the corresponding Excel column number of STR
.
The result of each query should be printed on a new line.
Constraints:
- 1 ≤ T ≤ 50
- 1 ≤ |STR| ≤ 12
Here, T
denotes the number of test cases, and |STR|
denotes the length of the string.
Time Limit : 1 sec

AnswerBot
4mo
Convert Excel sheet column title to corresponding column number.
Iterate through the characters in the string from right to left, starting with a result of 0.
For each character, calculate its value by ...read more
Help your peers!
Add answer anonymously...
Stay ahead in your career. Get AmbitionBox app


Trusted by over 1.5 Crore job seekers to find their right fit company
80 L+
Reviews
10L+
Interviews
4 Cr+
Salaries
1.5 Cr+
Users
Contribute to help millions
AmbitionBox Awards
Get AmbitionBox app

