# Easy
class Solution: def convertToTitle(self, n: int) -> str: alp = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" return self.helper(n, alp) def helper(self, n, alp): if n <= 26: return alp[n-1] ch = alp[n%26-1] return self.helper(n//26, alp)+ch
该怎么计算时间复杂度呢? O(log26n)O(log_{26}^n)O(log26n) ---> O(lgn)O(lgn)O(lgn)? 空间复杂度也是一样的?
Last updated 4 years ago
Was this helpful?