Skip to content

Commit 375eefe

Browse files
author
Tushar Borole
committed
340. Longest Substring with At Most K Distinct Characters
1 parent 284474b commit 375eefe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

k_distinct_characters.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
117
/**
218
* @param {string} s
319
* @param {number} k

0 commit comments

Comments
 (0)