#3099

Harshad Number

newbie · 145 · lc easy +13 · 83.4% accepted · 212 likes · top 95%

Description

A Harshad number is an integer divisible by its own digit sum. Given an integer x, return the digit sum of x if x is a Harshad number, or -1 otherwise.

Code

1
2
3