Category: what_to_track
-
LeetCode 242: Valid Anagram
link Sort Sorted, anagrams must be identical. Time: , space: . Character map Every character of t must appear in s possibly in different order. Time: , space: .
-
LeetCode 266: Palindrome Permutation
link As we build {char -> count} map, we can find out the count of characters that appear odd number of times. For a palindrome there can be at most 1 such character. Time: , space: . We can also maintain a set of characters that appear odd number of times.