We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b19cfec commit 31d4c88Copy full SHA for 31d4c88
Easy/258.Add Digits.playground/Contents.swift
@@ -39,4 +39,8 @@ class Solution {
39
}
40
return res
41
42
+
43
+ func addDigits2(_ num: Int) -> Int {
44
+ return num == 0 ? 0 : (num - 1) % 9 + 1
45
+ }
46
0 commit comments