Excel Sheet | Part-2
You are given a string STR representing the column title in an Excel Sheet. You need to find its corresponding column number.
For example: A corresponds to 1, B to 2, C to 3, … , Z to 26, AA to 27, .. and so on.
Input Format:
The first line of input contains a single integer T, representing the number of test cases or queries to be run.
Then the 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 the characters would be capital English alphabets.
Output Format:
For each test case, you need to return the corresponding excel column number of STR.
The output of each query must be printed in a new line.
Note:
You are not required to print the expected output, it has already been taken care of. Just implement the function.
Constraints:
1 ≤ T ≤ 50
1 ≤ |STR| ≤ 12
where 'T' denotes number of testcases, and |STR| denotes the length of the string.
Time Limit : 1 sec
CodingNinjas
author
2y
Optimal Solution
- The solution to this problem is like base 26 number conversion. Why 26? Because the number of capital english alphabets is 26.
- For example, while converting binary to decimal, we take b...read more
Help your peers!
Add answer anonymously...
Top Lowe's Full Stack Developer interview questions & answers
Popular interview questions of Full Stack Developer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app