Pergunta de entrevista da empresa Pandora

Given an array of songs, write an algorithm that returns the first stale (aka repeated) song.

Resposta da entrevista

Sigiloso

3 de dez. de 2015

(In Swift) I wrote a function that takes an array as parameter and returns an optional String. I stored all songs in a dictionary, the key was the song and value was the count of repeated songs in the array. I returned the first song in the dictionary with count >1.