Hacker News new | past | comments | ask | show | jobs | submit login

Tokenize, concatenate, sort, reduce.

MCMLXVII + LXV

M CM L X V I I + L X V

M CM L X V I I L X V

M CM L L X X V V I I

V+V=X, L+L=C, C+CM=M so MMXXXII. Convert everything to decimal if you wanna check my work.

Note that converting CM to DCCCC is actually pretty unnecessary since you can just combine CM and C to make M instead of having to count up lots of C’s. A computer algorithm would be simpler by reducing CM to DCCC but adjusting for human fallibility, allowing for CM + C = M makes things a little easier.

Also note that this method scales to any number of sums, not just adding two numbers together.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: