New update is available. Click here to update.
sidenav-btnClose
Topic list
Excel Equivalent of a Decimal Number
MEDIUM
25 mins
1 upvotes
Other topics
Problem solved
Skill meter
Strings
-
Matrices (2D Arrays)
-
Sorting
-
Binary Search
-
Linked List
-
Stacks & Queues
-
Trees
-
Graph
-
Dynamic Programming
-
Greedy
-
Tries
-
Arrays
-
Binary Search Trees
-
Heap
-
Bit Manipulation
-

Excel Equivalent of a Decimal Number

Contributed by
Deep Mavani
Medium
Avg time to solve 25 mins
Success Rate 50 %
Share
1 upvotes

Problem Statement

Given a positive number 'N'. Your task is to find the Excel Equivalent of the number 'N'.

Note:

1. The Excel equivalent of 1 is "A", the Excel equivalent of 2 is "B" ……………, the Excel equivalent of 26 is "Z". 

2. The Excel equivalent of 27,28…,52 is "AA", "AB"…."AZ" respectively.

3. The Excel Equivalent of 53,54….78 is "BA", "BB"….."BZ".

4. The pattern shown above can be used to find the excel equivalent of any positive number.

5. There is only one Excel Equivalent for a given positive number.
Detailed explanation ( Input/output format, Notes, Constraints, Images )
Sample Input 1:
2
2
9
Sample Output 1:
B
I
Explanation of Sample Output 1:
In test case 1, the Excel Equivalent of 2 is B.

In test case 2, the Excel Equivalent of 9 is I.
Sample Input 2:
2 
27
31
Sample Output 2:
AA
AE
Explanation of Sample Output 2:
In test case 1, the Excel equivalent of 26 is Z and therefore the Excel equivalent of 27 is AA.

In test case 2, the Excel equivalent of 27 is AA and therefore the Excel equivalent of 31 will be AE.
Reset Code
Full screen
copy-code
Console