3
vector<int> intersection(vector<vector<int>> &nums) {4
int n = nums.size(); // gives the no. of rows5
map<int, int> mp; // we don't need unordered_map because we need the6
// elements to be in sorted format.9
// traverse through the 2D array and store the frequency of each element10
for (int row = 0; row < n; row++) {11
for (int col = 0; col < nums[row].size(); col++) {16
// In the 2D array, intersection occurs when the elements are present in17
// every row. So the frequency of the element should match with the no. or18
// rows in the 2D array.19
for (auto element : mp)20
if (element.second == n) vec.push_back(element.first);22
// return the intersecting elements