add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
25
solutions/13/q1317/solution.go
Normal file
25
solutions/13/q1317/solution.go
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
package q1317
|
||||
|
||||
func noZero(n int) bool {
|
||||
for ; n > 0; n /= 10 {
|
||||
if n%10 == 0 {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func getNoZeroIntegers(n int) []int {
|
||||
for i := 1; i <= n/2; i++ {
|
||||
if !noZero(i) {
|
||||
continue
|
||||
}
|
||||
j := n - i
|
||||
if noZero(j) {
|
||||
return []int{i, j}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
var _ = getNoZeroIntegers
|
||||
Loading…
Add table
Add a link
Reference in a new issue