Problem statement

https://binarysearch.com/problems/The-Auditor/

Solution

Equal to Leetcode 0171. Excel Sheet Column Number.

Complexity

It is O(log^2 n) for time and O(log n) for space, where n is the answer.

Code

class Solution:
    def solve(self, s):
        return sum([(ord(T)-ord("A")+1)*26**i for i,T in enumerate(s[::-1])])