Screen Link:
Question: Find the visitor who spent the most amount of time at the White House?
My answer: Alan C. Prather
First, please tell me whether my answer is correct?
Second, I’d like to know if there’s better approach to arrive at the answer?
My approach:
Step 1 - I created a dictionary with unique visitor names as keys and their cumulative meeting durations as values.
Step 2 - I reversed the keys and values to create another dictionary so that I can use the max
function to find out the maximum cumulative duration of meetings and the corresponding visitor, which would be our answer.