1056. Confusing Number
On This Page
class Solution:
def confusingNumber(self, n: int) -> bool:
x, y = n, 0
d = [0, 1, -1, -1, -1, -1, 9, -1, 8, 6]
while x:
x, v = divmod(x, 10)
if d[v] < 0:
return False
y = y * 10 + d[v]
return y != n