Data structure exercise

Hello! Has anyone resolved the exercise on their first try ? I had some basic idea on how to solve but apparently it was at most 10% of the entire exercise solution and the solution that Mosh provided left me starring at the monitor …

1 Like

Hi.
It took me 5 minutes. That is my first try. I am not sure if that is correct… However:

sentence = “This is a common interview question”
winner = " "
summary = 0
for item in sentence.replace(" ", “”):
number = sentence.count(item)
if number > summary:
summary += number
winner = item, number

print(winner)