```
def isStrobogrammatic1(self, num):
deque = collections.deque(map(int, list(num)))
while len(deque) >= 2:
l, r = deque.popleft(), deque.pop()
for i in [2,3,4,5,7]:
if i in [l, r]:
return False
if (l, r) in [(6,6), (9,9)] or (l != r and (l, r) not in [(6,9), (9,6)]):
return False
return not deque or deque.pop() in [0,1,8]
def isStrobogrammatic(self, num):
dic = {"0":"0", "1":"1", "6":"9", "8":"8", "9":"6"}
l, r = 0, len(num)-1
while l <= r:
if num[l] not in dic or dic[num[l]] != num[r]:
return False
l += 1
r -= 1
return True
```