Search
⌘K

Leetcode 2544. Alternating Digit Sum

Compute the alternating sum of an integer's digits, assigning a positive sign to the most significant digit and alternating signs for each subsequent digit. This is a straightforward O(number of digits) scan where you accumulate digits with alternating +/− signs.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Your account is free and you can post anonymously if you choose.