Is this you? As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.
Claim your profile
Instead of counting two sums (of odd and even digits) and returning their difference, you could use a single sum value, subtracting a digit's value if it's even and adding if it's odd. An added benefit of this approach is that you are more protected from integer overflows: if odd and even digits are interleaved, the two-sum approach will be much less likely to overflow.
Instead of counting two sums (of odd and even digits) and returning their difference, you could use a single sum value, subtracting a digit's value if it's even and adding if it's odd. An added benefit of this approach is that you are more protected from integer overflows: if odd and even digits are interleaved, the two-sum approach will be much less likely to overflow.
As a journalist, you can create a free Muck Rack account to customize your profile, list your contact preferences, and upload a portfolio of your best work.