C# Solution


  • 0
        public int TitleToNumber(string s) {
            int index = 0, count = s.Length - 1, result = 0;
            
            while (count >= 0)
                result += ((int)s[index++] - 64) * (int)Math.Pow(26, count--);
            
            return result;
        }

Log in to reply
 

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