Hacker Timesnew | past | comments | ask | show | jobs | submitlogin

Doing a single modulo 9 operation is much faster than summing a d-digit number, which requires d modulo 10s, d divide 10s, and d sums.


You can do the sum by looking directly at the digits in the string, no need for module at all.


Number to string is even more expensive.




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

Search: