LeetCode Medium HashtableSummary

Types of problems and data structures and algorithms used to solve them

1. String search

Trie、HashMap

2. Frequency, statistics, frequency statistics results

HashSet, HashMap getOrDefault(key, 0)+1 count, bucket sorting

3, string replacement, combination

HashMap duplicate check, custom Trie (word tree), word array comparison char

4, custom data structure, sorting

PriorityQueue, custom comparator

ps:

speed:

The fastest attribute array marking, i.e. preprocessing before starting the operation.

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325297586&siteId=291194637