Leetcode 830. Positions of Large Groups
Posted 周洋的Blog
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Leetcode 830. Positions of Large Groups相关的知识,希望对你有一定的参考价值。
class Solution: def largeGroupPositions(self, S: str) -> List[List[int]]: ans = [] size = len(S) if size < 3: return [] i = 0 while i < size: length = 1 j = i + 1 while j < size and S[i] == S[j]: j += 1 length += 1 if length > 2: ans.append([i, j - 1]) i = j return ans
以上是关于Leetcode 830. Positions of Large Groups的主要内容,如果未能解决你的问题,请参考以下文章
830. Positions of Large Groups - LeetCode
[LeetCode&Python] Problem 830. Positions of Large Groups
Leetcode 830. Positions of Large Groups
830. Positions of Large Groups