You are given a list of preferences for n friends, where n is always even. For each person i, preferences[i] contains a list of friends sorted in the order of preference. Friends in each list are denoted
Problem 2. [Category: Optional: Coding] Here is another problem that is relate to stable matching.You are given a list of preferences for n friends,…