Multiset implementation using doubly linkedlist

I was trying to implement multiset using link list and doubly link list just trying to find how it impacts time complexity and space in implementation of multiset using doubly link list

@tripathiaman2997, doubly linked list can give you advantage if you associate iterator with your multiset , i.e if you are inserting or deleting an element at address pointed by iterator , doubly linked list can do this in o(1) but singly linked list might need O(n) in worst case scenarios for these operation

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

Please help me to solve this question I got this one in the interview not able to solve

Test Case:
2 2
1 2
0 1
Answer: 3