Simple 3 lines Solution


  • -2
        public static int titleToNumber(String s) {
    		int colNumber=0; char[] chars=s.toCharArray(); int l=chars.length;
    		for(int i=0;i<l;i++) colNumber+=(chars[i]-64)*Math.pow(26,l-1-i);
    		return colNumber;
    	}

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.