The anagram test is commonly used to demonstrate how an naive implementation can perform significant order of magnitudes slower than an efficient one. We’ll also briefly go over why each implementation is not as efficient as you could make it.
A word is an anagram of another if you can rearrange its characters to produce the second word. Here we’ll write multiple increasingly more efficient functions that given two strings determines if they are anagrams of each other.
This was an AWESOME video! Would love more of these showing similar utilities.
Thanks 🌹. Will do ❤️
Awesome video. Shouldn't we compare the length of each word, and return false if lengths are not equal?
String is iterable then you may apply for of without splitting it
I prefer to use Array.from('string') to convert to an array and avoid N searchs
modifying arguments is a bad practice
Hi Basarat, great video! Could you please give examples on when is the best to use Map?
I notice you used Map in this video to solve the problem but in TypeScript Map is not supported and it does not look like it is going to be supported anytime soon. What would be the best way to use this?
It would be very helpful if you could publish a working demo into github.
I would be interested to see how you compiled the Map and Array.from into ES6 and made it work, because I am experiencing " TS2495: Type 'IterableIteratorShim<number>' is not an array type or a string type" errors after installing ES6-Shim and type definition files.
hi, great , but this msg in Ide Error:(48, 27) TS2304: Cannot find name 'Map'.
No need for string.split('') for (let char of word) works fine.
great video!