about | help | code help+videos | done | prefs |
Given an array of non-empty strings, return an int array containing the total number of occurrences for each unique string, in the order they first appear in the array. You must solve this using a HashMap to ensure Θ(n) amortized time. countTotalsByFirstOccurrence(["w", "W"]) → [1, 1] countTotalsByFirstOccurrence(["one"]) → [1] countTotalsByFirstOccurrence(["a", "b", "a", "a", "b"]) → [3, 2] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 310
Copyright Nick Parlante 2017 - privacy