4 Lines Java Solution


  • 0
    E
    public class Solution {
        public int titleToNumber(String s) {
            int res=0;
            for(int i=0;i<s.length();i++){
                res=res*26+(s.charAt(i)-64);
            }
            return res;
        }
    }
    

Log in to reply
 

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