categories: computer science
Hello everyone,
Below you will find a video with a detailed explanation of the algorithm for determining whether two words are anagrams. Its operation, time complexity, and usefulness. Below you will also find ready-made code to copy if needed.
Code:
slowo1 = "abcdefg"
slowo2 = "gfedcba"
def anagram(slowo):
slownik = {}
for znak in slowo:
slownik[znak] = 0
for i in slowo:
slownik[i] += 1
return slownik
if anagram(slowo1) == anagram(slowo2):
print("Slowa sa angramami", end=None)
Video:
Thank you for reading!
Read more