You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Understand what the interviewer is asking for by using test cases and questions about the problem.
Will the points always be a positive integer?
Yes, but most solutions will work for negative point values too.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: If the player is already in the dict, add points to their score, otherwise, make a new entry in the dict for them.
1) Check if player is in the dict
2) If so, add points to that player's current score
3) Otherwise, map player -> points in the dict
4) Return the updated dict
⚠️ Common Mistakes
If you try to ADD to a score for someone who is NOT already in the dict, you'll get a KeyError.