about | help | code help+videos | done | prefs |
A frequency table is defined as a table containing each distinct item in a set and its corresponding number of occurrences. Define a function that when passed an integer array, returns the frequency table. The items should occur in order of their first occurrences in the original array. Because of the inability of codingbat to process mutli-dimensional array, the table should be an array of String objects, where each String represents the item and its frequency separated by a comma and a space (", "). frequencyTable([10, 70, 20, 70]) → ["10, 1", "70, 2", "20, 1"] frequencyTable([5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5]) → ["5, 14"] frequencyTable([1, 2, 3, 4, 1, 2, 3, 4, 4, 3, 2, 1, 1, 3, 2, 4, 4, 2, 3, 1, 5]) → ["1, 5", "2, 5", "3, 5", "4, 5", "5, 1"] ...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: 4 Post-solution available
Copyright Nick Parlante 2017 - privacy