We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I think the best way to do this is by using multiset (called as Counter in Python, this can be found in the collections module). For more info read this link. First store the input data in the form of list. Then use this list (an iterable) to generate the counter object. This object will have a key-value pair.
Further, you need to iterate through the two sets and find the value in the counter object and increase / decrease happiness.
No Idea!
You are viewing a single comment's thread. Return to all comments →
I think the best way to do this is by using multiset (called as Counter in Python, this can be found in the collections module). For more info read this link. First store the input data in the form of list. Then use this list (an iterable) to generate the counter object. This object will have a key-value pair.
Further, you need to iterate through the two sets and find the value in the counter object and increase / decrease happiness.