242. Valid Anagram
Given two stringss_and_t , write a function to determine ift_is an anagram of_s.
Example 1:
Example 2:
Note: You may assume the string contains only lowercase alphabets.
Follow up: What if the inputs contain unicode characters? How would you adapt your solution to such case?
Thoughts:
Give compare the canical sorted form
Compare the char count in the map
Follow-up: Method 1 would still work
Code: Sort
Code: Counting Map (elements in s and t needs to be hashable)
Last updated
Was this helpful?