mirror of
https://github.com/halfrost/LeetCode-Go.git
synced 2025-07-06 17:44:10 +08:00
Update 1446 solution
This commit is contained in:
@ -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++
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
```
|
Reference in New Issue
Block a user