ycliper

Популярное

Музыка Кино и Анимация Автомобили Животные Спорт Путешествия Игры Юмор

Интересные видео

2025 Сериалы Трейлеры Новости Как сделать Видеоуроки Diy своими руками

Топ запросов

смотреть а4 schoolboy runaway турецкий сериал смотреть мультфильмы эдисон
Скачать

leetcode problem 3085|Minimum Deletions to Make String K-Special| java | c++ | Hindi

leetcode

potd

medium

3085

Автор: MissLogic - "Where code meets Clarity."

Загружено: 2025-06-21

Просмотров: 43

Описание: You are given a string word and an integer k.

We consider word to be k-special if |freq(word[i]) - freq(word[j])| less than or equal to k for all indices i and j in the string.

Here, freq(x) denotes the frequency of the character x in word, and |y| denotes the absolute value of y.

Return the minimum number of characters you need to delete to make word k-special.



Example 1:

Input: word = "aabcaba", k = 0

Output: 3

Explanation: We can make word 0-special by deleting 2 occurrences of "a" and 1 occurrence of "c". Therefore, word becomes equal to "baba" where freq('a') == freq('b') == 2.

Example 2:

Input: word = "dabdcbdcdcd", k = 2

Output: 2

Explanation: We can make word 2-special by deleting 1 occurrence of "a" and 1 occurrence of "d". Therefore, word becomes equal to "bdcbdcdcd" where freq('b') == 2, freq('c') == 3, and freq('d') == 4.

Example 3:

Input: word = "aaabaaa", k = 2

Output: 1

Explanation: We can make word 2-special by deleting 1 occurrence of "b". Therefore, word becomes equal to "aaaaaa" where each letter's frequency is now uniformly 6.

Не удается загрузить Youtube-плеер. Проверьте блокировку Youtube в вашей сети.
Повторяем попытку...
leetcode problem 3085|Minimum Deletions to Make String K-Special| java | c++ | Hindi

Поделиться в:

Доступные форматы для скачивания:

Скачать видео

  • Информация по загрузке:

Скачать аудио

Похожие видео

Leetcode problem 2016 | maximum difference between increasing elements| java | c++ | english

Leetcode problem 2016 | maximum difference between increasing elements| java | c++ | english

leetcode problem 3085|Minimum Deletions to Make String K-Special| java | c++ | English

leetcode problem 3085|Minimum Deletions to Make String K-Special| java | c++ | English

Rádio Diante do Trono - 24 Horas Online

Rádio Diante do Trono - 24 Horas Online

Leetcode Problem 440 | Kth number in lexicographical order | Stepwise solution | java | cpp | Hindi

Leetcode Problem 440 | Kth number in lexicographical order | Stepwise solution | java | cpp | Hindi

leetcode problem 3443 | Maximum Manhattan Distance After K Changes| java | c++ | English

leetcode problem 3443 | Maximum Manhattan Distance After K Changes| java | c++ | English

Учим неправильные глаголы | Speak all Week | Разговорный английский

Учим неправильные глаголы | Speak all Week | Разговорный английский

Что такое TCP/IP: Объясняем на пальцах

Что такое TCP/IP: Объясняем на пальцах

Функция ВПР в Excel ➤ Как пользоваться функцией ВПР (VLOOKUP) в Excel

Функция ВПР в Excel ➤ Как пользоваться функцией ВПР (VLOOKUP) в Excel

4 Hours Chopin for Studying, Concentration & Relaxation

4 Hours Chopin for Studying, Concentration & Relaxation

Можно ли поменять родину так быстро? / вДудь

Можно ли поменять родину так быстро? / вДудь

© 2025 ycliper. Все права защищены.



  • Контакты
  • О нас
  • Политика конфиденциальности



Контакты для правообладателей: [email protected]