forked from codepath/compsci_guides
-
Notifications
You must be signed in to change notification settings - Fork 0
Perfect Match
Jessica Sang edited this page Sep 14, 2024
·
1 revision
Unit 3 Session 1 (Click for link to problem statements)
Understand what the interviewer is asking for by using test cases and questions about the problem.
- When we call the function, what will that input parameter be used for?
- It will be the dictionary the loop iterates over.
Plan the solution with appropriate visualizations and pseudocode.
General Idea: Call the function with the input dictionary.
1) Extract the unique parts of each string (there will be two)
2) Create a dictionary with the first parts as the keys and the second as the values
3) Call the function with the dictionary as the input
match_made({"Peanut butter": "Jelly", "Spongebob": "Patrick", "Ash": "Pikachu"})