Search
Excel Column Number InterviewBit Solution
- illuminati

- Sep 5, 2020
- 1 min read
Updated: Oct 4, 2020
Problem: Excel Column Number
Problem Description:
Given a column title A as appears in an Excel sheet, return its corresponding column number.
Problem Constraints
1 <= |A| <= 100Input Format
First and only argument is string A.Output Format
Return an integerExample Input
Input 1:
1
Input 2:
28Example Output
Output 1:
"A"
Output 2:
"AB" Example Explanation
Explanation 1:
1 -> "A"
Explanation 2:
A -> 1
B -> 2
C -> 3
...
Z -> 26
AA -> 27
AB -> 28 Approach
This question is about base conversion, just think what would you have done if you have given a binary (base-2) instead of base-26.
Time & Space Complexity:
Time Complexity: O(N) - N is the size of the string.
Space Complexity: O(1)

Comments