InterviewBit - Excel Column  

by ne on 2021-03-02 under Algo

This problem is a property of InterviewBit (

Full details of the question, and if you want to try it out yourself, proceed to interviewbit :

Here's the implementation:


public class Solution {
    public int titleToNumber(String A) {
        int m=(int)Math.pow(26,(A.length()-1));
        return rec(A, m==0?1:m);
    private int rec(String a, int m){
        if(a.length()==0) return 0;
        return (m*(a.charAt(0)-64))+rec(a.substring(1),m/26);

Happy Coding !