This commit is contained in:
VicRen
2021-01-21 08:49:40 +08:00
parent 46297b22a7
commit 592c7c2686
2 changed files with 74 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
package main
import "strings"
const balloon = "balloon"
func main() {
}
func maxNumberOfBalloons(text string) int {
nt := text
lt := text
end := false
count := 0
for {
for _, c := range balloon {
nt = strings.Replace(lt, string(c), "", 1)
if nt == lt {
end = true
break
}
lt = nt
}
if end {
break
}
count++
}
return count
}