Simple python solution and easy to understand

  • 0
    class Solution(object):
        def isStrobogrammatic(self, num):
            :type num: str
            :rtype: bool
            reversed_num = ''
            for n in reversed(num):
                n = num_mapping.get(n, '')
                reversed_num += n
            return reversed_num == num

Log in to reply

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