KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I want to create different methods for a class called Multiset . I have all the required methods, but I'm unsure of how to write intersection, union, and subset methods. For intersection and union, my code starts like this: def intersect(var) x = Multiset.new end Here is an example: X = [1, 1, 2, 4] Y = [1, 2, 2, 2] then the intersection of X and Y is [1, 2] .
Tags (comma-separated)
Save Edits
Cancel