Update 1446 solution

This commit is contained in:
halfrost
2021-12-10 21:21:21 +08:00
parent 4f120e3c23
commit e4ea6b83a6
9 changed files with 92 additions and 12 deletions

View File

@ -1,9 +1,7 @@
package leetcode
func maxPower(s string) int {
cur := s[0]
cnt := 1
ans := 1
cur, cnt, ans := s[0], 1, 1
for i := 1; i < len(s); i++ {
if cur == s[i] {
cnt++

View File

@ -1,4 +1,4 @@
# [1446. Consecutive Characters](https://leetcode-cn.com/problems/consecutive-characters/)
# [1446. Consecutive Characters](https://leetcode.com/problems/consecutive-characters/)
## 题目
@ -54,9 +54,7 @@ Given a string s, return the power of s.
package leetcode
func maxPower(s string) int {
cur := s[0]
cnt := 1
ans := 1
cur, cnt, ans := s[0], 1, 1
for i := 1; i < len(s); i++ {
if cur == s[i] {
cnt++
@ -73,4 +71,5 @@ func maxPower(s string) int {
}
return ans
}
```