Three lessons:
Sets automatically remove duplicates.
Membership checks in sets are faster than in arrays.
Intersection problems map directly to set operations in code.
When you see "find common elements," think sets and intersection.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
summary
Three lessons:
Sets automatically remove duplicates.
Membership checks in sets are faster than in arrays.
Intersection problems map directly to set operations in code.
When you see "find common elements," think sets and intersection.