Better HN
top
new
best
ask
show
jobs
Log in
Sign up
How to encode two integers into a single integer | Better HN
How to encode two integers into a single integer
(twitter.com)
1 points · by
helloiloveyou
· 6y ago · 1 comment
Comments
[–]
billsimms
6y ago
Alternate the digits, or the bits, of the two numbers and prepend 0's onto the shorter number if needed. Accomplishes this in 2n digits or bits instead of 2^n.
X on X
X on X
X (formerly Twitter)