[LeetCode][Python3] 395. Longest Substring with At Least K Repeating Characters
2019. 3. 28. 01:03 |
프로그래밍/LeetCode
Problem :
https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters/
My Solution :
class Solution:
def longestSubstring(self, s: str, k: int) -> int:
if len(s) < k:
return 0
for c in set(s):
if s.count(c) < k:
return max(self.longestSubstring(T, k) for T in s.split(c))
return len(s)
'프로그래밍 > LeetCode' 카테고리의 다른 글
[LeetCode][Python3] 116. Populating Next Right Pointers in Each Node (0) | 2019.03.30 |
---|---|
[LeetCode][Python3] 208. Implement Trie (Prefix Tree) (1) | 2019.03.30 |
[LeetCode][Python3] 239. Sliding Window Maximum (0) | 2019.03.29 |
[LeetCode][Python3] 315. Count of Smaller Numbers After Self (0) | 2019.03.28 |
[LeetCode][Python3] 73. Set Matrix Zeroes (0) | 2019.03.27 |
[LeetCode][Python3] 329. Longest Increasing Path in a Matrix (0) | 2019.03.27 |
[LeetCode][Python3] 264. Ugly Number II (0) | 2019.03.26 |
[LeetCode][Python3] 334. Increasing Triplet Subsequence (0) | 2019.03.25 |
최근에 달린 댓글 최근에 달린 댓글