Minimum Anagram Deletions
Imagine you have two sets of letters and want to leave only the letters that can form the same word in a different order. Write a function make_anagram_deletions that returns the minimum number of character deletions needed to make strings a and b anagrams of each other. In one operation, you may delete one character from either string.
Примеры
Ввод
"cde", "abc"Вывод
4Ввод
"abc", "abc"Вывод
0Ввод
"aaa", "a"Вывод
2Нужно реализовать
def make_anagram_deletions(a: str, b: str) -> int:
Теги
stringshashmapdict
Přihlaste se, abyste viděli historii odevzdání
Přihlásit sePřihlaste se, abyste mohli použít AI mentora
Přihlásit seVisible tests
1
Input
"cde", "abc"Expected
42
Input
"abc", "abc"Expected
03
Input
"aaa", "a"Expected
24
Input
"", "abc"Expected
35
Input
"fcrxzwscanmligyxyvym", "jxwtrhvujlmrpdoqbisbwhmgpmeoke"Expected
306
Input
"showman", "woman"Expected
2Focus radio
Paused · SomaFM · Fluid