Skip to content
This repository has been archived by the owner on May 3, 2024. It is now read-only.

Commit

Permalink
leetcode: finished #395
Browse files Browse the repository at this point in the history
  • Loading branch information
xqm32 committed Jan 13, 2024
1 parent 5225e91 commit 9c2e4d8
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions content/leetcode/2024/1.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,30 @@ title: 2024.1
draft: false
---

# 2024.1.13

```python
#
# @lc app=leetcode.cn id=395 lang=python3
#
# [395] 至少有 K 个重复字符的最长子串
#


# @lc code=start
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)


# @lc code=end
```

# 2024.1.12

```python
Expand Down

0 comments on commit 9c2e4d8

Please sign in to comment.