Loading page…
A word puzzle in a payments app needs a hundred thousand dictionary words grouped by their letters. Comparing every pair makes about five billion comparisons. Counting with a map is one line, and grouping is the same move with a list: compute a key for each word, such as its letters in sorted order, and let the map collect the positions. A bad key, such as a sum, joins words that do not belong together, and a map keeps no order.
The rewards tab of a payments app has a daily word puzzle.