Opening your workspace…
Workspace/Coding room
Opening your workspace…
In a jellyfish lake, a diver records the jellyfish drifting past a marker. Each jellyfish is identified by its species name. Return the species seen most often; if several are tied, return the alphabetically earliest name.
["moon","spotted","moon","golden"]Output"moon"Moon jellyfish appear twice, more than any other species.
["golden","moon","spotted","moon","golden"]Output"golden"Golden and moon jellyfish each appear twice, so the alphabetically earlier name wins.
Count each species, then break ties by name.
function solve(sightings) { // Write your solution here. }
Tab inserts two spaces. Shift+Tab outdents. Use the arrow keys and Tab to choose a suggestion. Press Escape, then Tab, to leave the editor. Press Control or Command with apostrophe to run samples or with Enter to submit.