My accepted easy solution using JAVA


  • 0
    J
    public class Solution {
        public int titleToNumber(String s) {
            int digit = s.length();
            int result = 0;
            for(int i = 0; i < digit; i++) {
                result = result * 26 + ((int)s.charAt(i) % 65 + 1);
            }
            return result;
        }
    }

Log in to reply
 

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