У нас вы можете посмотреть бесплатно String - 9: Find longest sub-string length with K distinct characters | Java Implementation или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
Source Code:https://thecodingsimplified.com/find-... Solution: We take a Map, which'll give me info about unique characters present, Map key will be character & value will be the occurrence of that character We'll take a max_length variable, where we'll store the solution we'll take two variable start & end, which'll point to 1st character in string initially Now we iterate the string & keep on putting character in map. If size of value is greater than K, then we decrease the character from start index. If occurrence becomes 0, we remove from map. max_length will be updated by end - start + 1 At last we return, max_length as answer Time Complexity: O(n) Space Complexity: O(n) Do Watch video for more info CHECK OUT CODING SIMPLIFIED / codingsimplified ★☆★ VIEW THE BLOG POST: ★☆★ http://thecodingsimplified.com I started my YouTube channel, Coding Simplified, during Dec of 2015. Since then, I've published over 400+ videos. ★☆★ SUBSCRIBE TO ME ON YOUTUBE: ★☆★ https://www.youtube.com/codingsimplif... ★☆★ Send us mail at: ★☆★ Email: thecodingsimplified@gmail.com