Stable Roommates Problem (Irving's Algorithm)
In Stable Roommates Problem, we are given an even-sized set in which each member has a preference list which consists of all other members of the set. We need to match the members of the set such that every member has most preferred choice as their roommate. This is solved using Irving's Algorithm.
Minimum Increment and Decrement operations to make array elements equal
We are given an array, we need to find the minimum number of increment and decrement operations (by 1) required to make all the array elements equal. We have explored two approaches where brute force approach take O(N^2) time while the efficient approach O(N logN) time.
Minimum number of increment (by 1) operations to make elements of an array unique
We are given a sorted array which might have duplicate elements, our task is to find the minimum number of increment (by 1) operations needed to make the elements of an array unique. We have solved this using two approaches one using two pointers and other using hashmap.