InterviewBit - Excel Column Title  

by ne on 2020-12-02 under Algo

This problem is a property of InterviewBit (www.interviewbit.com).

Full details of the question, and if you want to try it out yourself, proceed to interviewbit : https://www.interviewbit.com/problems/excel-column-title/

Here's the implementation, this method will return column title for the given column number

 


  private static String rec(int col){
        if(col<27){
          return ""+(char)(64+col);
        }else{
          if(col%26==0){
            return rec((col/26)-1) +(char)(64+26);
          } else         
          return rec(col/26)+(char)(64+(col%26));
        }
    }


Happy Coding !