My python solution, easy to understand


  • -5
    J

    I am not using one line solution, which is hard at understand the recursion part.
    this solution is easy to understand, very simple recursion.

    s = ''
    while(num):
        s = chr(((num-1)%26)+ord('A'))+s
        num = (num-1)/26
    return s

  • 0
    H

    You need to reverse s and use // for floor div. otherwise, very good


Log in to reply
 

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