o(logN) solution but still getting time out. why?

  • 0

    Why am I getting time out on this solution below. It is only O(logN).

        def reverse(num):
            result = 0    
            while num:
                result = result * 10 + num%10        
                num = num/10        
            return result

Log in to reply

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