Skip to content
Better HN
Top
Best
Ask
Show
New
Jobs
Search
⌘K
How to encode two integers into a single integer
(opens in new tab)
(twitter.com)
1 points
helloiloveyou
6y ago
1 comments
Save
Share
1 comments
1 comments · 1 top-level
top
newest
oldest
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.
j
/
k
navigate · click thread line to collapse