Review Hashmap code problems

**Questions**

Name | Example |
---|---|

Use a local hashmap, instead of a global one | Leetcode: Increasing Subsequences |

One hashmap vs two hashmap | Leetcode: Before and After Puzzle |

- Use a tuple as key

## Blog link: https://code.dennyzhang.com/group-shifted-strings class Solution: def groupStrings(self, strings): """ :type strings: List[str] :rtype: List[List[str]] """ import collections m = collections.defaultdict(list) for s in strings: # ba -> (0, 25) # az -> (0, 25) tup = tuple([(ord(ch)-ord(s[0]))%26 for ch in s]) m[tup].append(s) return [m[key] for key in m]

See all hashmap problems: #hashmap

- Review: Hashmap Problems
- LintCode: Word Frequency Count
- LintCode: Valid Array
- LintCode: Same Number
- LintCode: Longest AB Substring
- LintCode: Function Runtime
- LintCode: Fermat Point Of Graphs
- Leetcode: X of a Kind in a Deck of Cards
- Leetcode: Verifying an Alien Dictionary
- Leetcode: Unique Number of Occurrences
- Leetcode: Unique Morse Code Words
- Leetcode: Unique Email Addresses
- Leetcode: Uncommon Words from Two Sentences
- Leetcode: Target Sum
- Leetcode: Sum of Distances in Tree
- Leetcode: Subdomain Visit Count
- Leetcode: Subarray Sum Equals K
- Leetcode: Split Array with Equal Sum
- Leetcode: Shortest Word Distance II
- Leetcode: Shortest Completing Word
- Leetcode: Sentence Similarity
- Leetcode: Pairs of Songs With Total Durations Divisible by 60
- Leetcode: Number of Boomerangs
- Leetcode: Number of Atoms
- Leetcode: Minimum Increment to Make Array Unique
- Leetcode: Longest Well-Performing Interval
- Leetcode: Longest String Chain
- Leetcode: Longest Repeating Substring
- Leetcode: Longest Harmonious Subsequence
- Leetcode: Line Reflection
- Leetcode: Kill Process
- Leetcode: K-diff Pairs in an Array
- Leetcode: Jewels and Stones
- Leetcode: Increasing Subsequences
- Leetcode: H-Index
- Leetcode: Group Shifted Strings
- Leetcode: Group Anagrams
- Leetcode: Graph Valid Tree
- Leetcode: Friends Of Appropriate Ages
- Leetcode: Find Words That Can Be Formed by Characters
- Leetcode: Find Duplicate Subtrees
- Leetcode: Find Duplicate File in System
- Leetcode: Find and Replace Pattern
- Leetcode: Fair Candy Swap
- Leetcode: Distinct Subsequences II
- Leetcode: Count Vowels Permutation
- Leetcode: Brick Wall
- Leetcode: Before and After Puzzle
- Leetcode: Array of Doubled Pairs
- Leetcode: 4Sum II

See more blog_posts.