Share my java solution


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

Log in to reply
 

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