Easy Solution


  • 0
    S
       public int titleToNumber(String s) {
            int result  = 0;
            for (int i = 0; i < s.length(); i++){
                result += ((s.charAt(i) - 'A') + 1) * Math.pow(26, s.length()-1-i);    
            }
            return result;
        }

Log in to reply
 

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