Hello and welcome to another coding interview test challenge.
Today we’ll be dealing with strings & substrings. Know the answer? Write it in a gist on github and leave a link to it in the comments below!
Given an integer k and a string s, find the length of the longest substring that contains at most k distinct characters.
For example, given s = “abcba” and k = 2, the longest substring with k distinct characters is “bcb”.