Retired
Highest amount of occurrences (retired)
Description:
Write a function called highestOccurrence
- Return the item in the array that occurrs the highest number of times
- The items in the array will either be strings(capitalization matters), numbers, or a combination of both
- If more than one item have the highest number of occurrences, return the item whose last instance occurs first in the array
Examples:
highestOccurrence([1, 2, 3, 4, 5, 5, 5]) // 5
highestOccurrence([1, 2, 3, 4, 5, 6, 555, 555, 555]) // 555
highestOccurrence(['hi', 'bye', 'hi']) // 'hi'
highestOccurrence(['hi', 'bye', 'hi', 'Hi', 'Hi', 'Hi']) // 'Hi'
highestOccurrence([2, 3, 4, 2, 'Hi', 'Hi', 'Hi']) // 'Hi'
highestOccurrence([1, 1, 2, 2, 3]) // 1
highestOccurrence([1, 2, 3, 3, 1]) // 3(because 3's final occurrence is before 1's final occurrence)
Algorithms
Logic
Loops
Control Flow
Basic Language Features
Fundamentals
Data Structures
Similar Kata:
Stats:
Created | Dec 5, 2017 |
Warriors Trained | 14 |
Total Skips | 0 |
Total Code Submissions | 78 |
Total Times Completed | 6 |
JavaScript Completions | 6 |
Total Stars | 0 |
% of votes with a positive feedback rating | 33% of 3 |
Total "Very Satisfied" Votes | 0 |
Total "Somewhat Satisfied" Votes | 2 |
Total "Not Satisfied" Votes | 1 |
Total Rank Assessments | 3 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 7 kyu |