Decimal “XOR” operator
Jelly, 14 bytes
DUz0«9_ṚƊṀƊ€UḌ
Try it online!
Grid of all single digit pairs
A monadic link taking a list of two integers as its argument and returning an integer.
Explanation
D | Decimal digits
U | Reverse order of each set of digits
z0 | Transpose with 0 as filler
Ɗ€ | For each pair of digits, do the following as a monad:
« Ɗ | - Minimum of the two digits and the following as a monad (vectorises):
9_ | - 9 minus the digits
Ṛ | - Reverse the order
Ṁ | - Maximum
U | Reverse the order of the answer to restore the orignal order of digits
Ḍ | Convert back from decimal digits to integer
If a digit matrix is acceptable input/output:
Jelly, 12 bytes
Uz0«9_ṚƊṀƊ€U
Try it online!
Pyth, 31 bytes
LhS,hb-9ebjkmeS,ydy_d_.t_MjRTQ0
Try it online!
LhS,hb-9eb # Helper function, computes the (x & ~y) part
L # y = lambda b:
S # sorted( )
, # [ , ]
hb # b[0]
-9eb # 9-b[-1]
h # [0] # sorted(...)[0] = minimum
jkmeS,ydy_d_.t_MjRTQ0 # Main program (example input Q: [123, 45])
jRTQ # convert each input to a list of digits -> [[1,2,3],[4,5]]
_M # reverse each -> [[3,2,1],[5,4]]
.t 0 # transpose, padding right with 0 -> [[3,5],[2,4],[1,0]]
_ # reverse -> [[1,0],[2,4],[3,5]]
m # map that over lambda d:
S, # sorted([ , ])
yd # y(d)
y_d # y(d[::-1]) # reversed
e # [-1] # sorted(...)[-1] = maximum
jk # ''.join( ^^^ )
Python 2, 71 bytes
f=lambda n,m,T=10:n+m and max(min(n%T,~m%T),min(m%T,~n%T))+f(n/T,m/T)*T
Try it online!