Same Letters Check
An anagram means you can rearrange the same characters to build another word or string. Given strings s and t, return True if they contain the same characters in the same counts. The order does not matter; only which characters appear and how many times each one appears. If the character counts differ, return False.
Примеры
Ввод
"anagram", "nagaram"Вывод
TrueВвод
"rat", "car"Вывод
FalseВвод
"", ""Вывод
TrueНужно реализовать
def is_anagram(s: str, t: str) -> bool:
Теги
stringshashmapdictsorting
Prihláste sa, aby ste videli históriu odoslaní
Prihlásiť saPrihláste sa, aby ste mohli používať AI mentora
Prihlásiť saVisible tests
1
Input
"anagram", "nagaram"Expected
True2
Input
"rat", "car"Expected
False3
Input
"", ""Expected
True4
Input
"a", "ab"Expected
False5
Input
"listen", "silent"Expected
True6
Input
"listen", "silent!"Expected
FalseFocus radio
Paused · SomaFM · Fluid