Course · Section 9: Data Structures, Modern Operators and Strings · Lecture 124: Maps: Fundamentals
Implement `frequency(arr)` that returns an object mapping each unique element of `arr` to the number of times it appears. Example: `frequency(['a','b','a','c','b','a'])` → `{ a: 3, b: 2, c: 1 }`.
+ 1 hidden test run on Submit.
A hash map tallies each value in one pass. O(n) time and space.
Run your code to see results.