LeetMotion
Given two strings s and t, return true if t is an anagram of s, and false otherwise.
An Anagram is a word or phrase formed by rearranging the letters of a different word or phrase, typically using all the original letters exactly once.
s and t consist of lowercase English letters.Instead of mapping both strings, we can map character frequencies for s, and then decrement frequencies for t.
s and tally each character in a frequency map.t, subtracting from the same frequency map.t has more of a character than s. Return False.t without going below 0, they are PERFECT anagrams.*Space complexity is O(1) because the size of the dictionary is bounded by 26 lowercase English letters.
Discussion
…