Playlist


Python Algorithmic thinking Searching Public

Easy  

15min


A playlist is considered a repeating playlist if any of the songs contain a reference to a previous song in the playlist. Otherwise, the playlist will end with the last song which points to None.

Implement a function is_repeating_playlist that returns true if a playlist is repeating or false if it is not.

For example, the following code prints "True" as both songs point to each other.

first = Song("Hello")
second = Song("Eye of the tiger")
    
first.next_song(second);
second.next_song(first);
    
print(first.is_repeating_playlist())
Python 3.6.5
   

  •   Example case: Wrong answer
  •   Song will repeat: Wrong answer
  •   Song will not repeat: Wrong answer
  •   Performance test on a large playlist: Wrong answer