We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 284474b commit 375eefeCopy full SHA for 375eefe
k_distinct_characters.js
@@ -1,3 +1,19 @@
1
+// 340. Longest Substring with At Most K Distinct Characters
2
+//
3
4
+// Given a string, find the length of the longest substring T that contains at most k distinct characters.
5
6
+// Example 1:
7
8
+// Input: s = "eceba", k = 2
9
+// Output: 3
10
+// Explanation: T is "ece" which its length is 3.
11
+// Example 2:
12
13
+// Input: s = "aa", k = 1
14
+// Output: 2
15
+// Explanation: T is "aa" which its length is 2.
16
+
17
/**
18
* @param {string} s
19
* @param {number} k
0 commit comments