LeetCode #242: Valid Anagram | Beginner's Coding Interview

preview_player
Показать описание
A step-by-step explanation of #LeetCode question 242: Valid Anagram
0:00 Problem overview
1:09 Code walkthrough
4:27 Variations

#programming #algorithms #coding
Рекомендации по теме
Комментарии
Автор

pls put more videos and more problems solutions sir please

Shivaji_
Автор

You’re really good man! Don’t stop making videos!

dnm
Автор

I understand your videos better than neetcode lol

josephinehan
Автор

Big fan of the channel and your videos! Another implementation you can do is to write a counter helper function that creates a dict and iterates through. Then return Counter(s) == Counter(t) in the main function.

rojerdu
Автор

What if we just did collections.Counter(string) for each and return the comaprison result ?
Like is it worse in time or space complexity? as per my understanding its O(n) in both same as your code?
or is it frowned upon during interviews?

srx
Автор

You said you could use an array instead of a dictionary ( like a -> 0, b -> 1, etc ). But how can you get the number of each character in the string, like what the dicitonary does, right it counts how many time you see a char in the string, you can't do that with an array where the index is set. Doesn't make sense.

aqualinespirit