top of page

### Looking to master object-oriented and system design for tech interviews or career growth?

• Improve your system design and machine coding skills.

• Study with our helpful resources.

**We're in beta mode and would love to hear your feedback.

Search

# Excel Column Title InterviewBit Solution

Problem Description: Given a positive integer A, return its corresponding column title as appear in an Excel sheet. Problem Constraints

`1 <= A <= 1000000000`

Input Format

`First and only argument is integer A.`

Output Format

`Return a string, the answer to the problem.`

Example Input

```Input 1:
A = 1
Input 2:
A = 28 ```

Example Output

```Output 1:
"A"

Output 2:
"AB" ```

Example Explanation

```Explanation 1:
1 -> A

Explanation 2:
1 -> A
2 -> B
3 -> C
...
26 -> Z
27 -> AA
28 -> AB  ```

## Approach

This question is just about the base conversion. Think about what would you have done if instead of excel (base-26) you were given a binary.

## Time & Space Complexity:

Time Complexity: O(logN) -> base 26

Space Complexity: O(1)

Code in C++

Tags: