Skip to content

Commit 72f7b82

Browse files
committed
258. Add Digits
1 parent 00e0123 commit 72f7b82

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

add-digits.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
class Solution {
2+
public:
3+
int addDigits(int num) {
4+
return 1 + (num - 1) % 9;
5+
}
6+
};

0 commit comments

Comments
 (0)