← ALL NOTES
Math

3622. Check Divisibility by Digit Sum and Product

This one is a straight arithmetic check: I read the digits of n once, keep a running sum and a running product, and test a single divisibility. The only thing worth thinking about is whether the divisor can be zero.

Loading…