leetcode1221

Posted AsenYang

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了leetcode1221相关的知识,希望对你有一定的参考价值。

 1 class Solution:
 2     def balancedStringSplit(self, s: str) -> int:
 3         count,res = 0,0
 4         for si in s:
 5             if si == L:
 6                 count += 1
 7             else:
 8                 count -= 1
 9             if count == 0:
10                 res += 1
11         return res

 

以上是关于leetcode1221的主要内容,如果未能解决你的问题,请参考以下文章