Awesome vid but minor note - for those of us not using python (js pleb, ik), it would be super helpful if things like creating a counting dict weren't abstracted away via an import. Just a thought, but either way, grateful for the vid :)
@Arjun-d1u3 ай бұрын
The best moment in every video "...And, it is accepted". 😂😂 That satisfaction after seeing Success.
@deepakjyoti83553 ай бұрын
Dashing videos by dashing Deepti !
@joneskiller82 ай бұрын
Why check for the values when you are checking for the length already? The characters can be transformed to other existing characters within the string so it should not matter.
@shravan17913 ай бұрын
Small correction: ```return (sorted(counts1.keys()) == sorted(counts2.keys())) and (sorted(counts1.values()) == sorted(counts2.values()))```
@jango82 ай бұрын
made it without collections, and dicts, and more readable as well , beats 99.99 % class Solution: def closeStrings(self, word1: str, word2: str) -> bool: word1_vals, word2_vals = set(word1), set(word2) if ( len(word1) != len(word2) or word1_vals != word2_vals ): return False else: word1_frequencies: List[int] = sorted( [word1.count(letter) for letter in word1_vals] ) word2_frequencies: List[int] = sorted( [word2.count(letter) for letter in word2_vals] ) return word1_frequencies == word2_frequencies