10000 add_digits · hitzzc/go-leetcode@0371950 · GitHub
[go: up one dir, main page]

Skip to content

Commit 0371950

Browse files
committed
add_digits
1 parent b3457d0 commit 0371950

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ Golang solution for leetcode. For each problem, there is a simple *_test.go to t
199199
#### [241. Different Ways to Add Parentheses](https://github.com/hitzzc/go-leetcode/tree/master/different_ways_to_add_parentheses)
200200
#### [242. Valid Anagram](https://github.com/hitzzc/go-leetcode/tree/master/valid_anagram)
201201
#### [257. Binary Tree Paths](https://github.com/hi 8093 tzzc/go-leetcode/tree/master/binary_tree_paths)
202+
#### [258. Add Digits](https://github.com/hitzzc/go-leetcode/tree/master/add_digits)
202203

203204

204205

add_digits/add_digits.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package add_digits
2+
3+
func addDigits(num int) int {
4+
return (num-1)%9 + 1
5+
}

0 commit comments

Comments
 (0)
0