Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit33a2bb7

Browse files
refactor 1297
1 parentbea7a4d commit33a2bb7

File tree

1 file changed

+0
-33
lines changed

1 file changed

+0
-33
lines changed

‎src/main/java/com/fishercoder/solutions/_1297.java

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -5,39 +5,6 @@
55
importjava.util.Map;
66
importjava.util.Set;
77

8-
/**
9-
* 1297. Maximum Number of Occurrences of a Substring
10-
*
11-
* Given a string s, return the maximum number of ocurrences of any substring under the following rules:
12-
*
13-
* The number of unique characters in the substring must be less than or equal to maxLetters.
14-
* The substring size must be between minSize and maxSize inclusive.
15-
*
16-
* Example 1:
17-
* Input: s = "aababcaab", maxLetters = 2, minSize = 3, maxSize = 4
18-
* Output: 2
19-
* Explanation: Substring "aab" has 2 ocurrences in the original string.
20-
* It satisfies the conditions, 2 unique letters and size 3 (between minSize and maxSize).
21-
*
22-
* Example 2:
23-
* Input: s = "aaaa", maxLetters = 1, minSize = 3, maxSize = 3
24-
* Output: 2
25-
* Explanation: Substring "aaa" occur 2 times in the string. It can overlap.
26-
*
27-
* Example 3:
28-
* Input: s = "aabcabcab", maxLetters = 2, minSize = 2, maxSize = 3
29-
* Output: 3
30-
*
31-
* Example 4:
32-
* Input: s = "abcde", maxLetters = 2, minSize = 3, maxSize = 3
33-
* Output: 0
34-
*
35-
* Constraints:
36-
* 1 <= s.length <= 10^5
37-
* 1 <= maxLetters <= 26
38-
* 1 <= minSize <= maxSize <= min(26, s.length)
39-
* s only contains lowercase English letters.
40-
* */
418
publicclass_1297 {
429
publicstaticclassSolution1 {
4310
publicintmaxFreq(Strings,intmaxLetters,intminSize,intmaxSize) {

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp