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.
Should I subtract entries if only the keys match, but not the values?
No -- only subtract when both keys AND values match.
P-lan
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Loop through each key in d1, check if it's in d2. If not, add to a list of results.
1) Create an empty dict for the result
2) Loop through each key in d1
a) If the key is not in d2 OR has a different value
i) Add key : value pair from d1 to results
b) If the key is in d2, but has a different value
i) Add key : value pair from d1 to results
3) Return results dict