Easy, clear and detailed explanation ( faster than 80.96% of Python3 online submissions)
FInd the length of the 2D array \n Use hashtable to find out the frequency of each element \n Check whether the frequency of an element equals the length of the
* FInd the length of the 2D array \n* Use hashtable to find out the frequency of each element \n* Check whether the frequency of an element equals the length of the 2D array ( This would specify that the element occurs in all the array of the 2D array)\n* Store the answer in the list and sort it\n\t\t\n\t\tdef intersection(self, nums: List[List[int]]) -> List[int]:\n\t\t\n\t\t""" Declarations """\n\t\t\n        n_of_lists = len(nums)  # finding no. array within 2D array\n\t\t\n        hmap = {} # hashmap to map the elements with their frequency\n\t\t\n        ans = [] # list to store the final answer\n\t\t\n\t\t""" Finding the frequency of each element """\n\t\t\n        for i in range(len(nums)):\n\t\t\n            for j in range(len(nums[i])):\n\t\t\t\n                if nums[i][j] in hmap:\n\t\t\t\t\n                    hmap[nums[i][j]] += 1\n\t\t\t\t\t\n                else:\n\t\t\t\t\n                    hmap[nums[i][j]] = 1\n\t\t\n\t\t""" Checking whether the frequency an element equals the no of the array within the 2D array """\n\t\t\n        for k, v in hmap.items():\n\t\t\n            if v == n_of_lists:\n\t\t\t\n                ans.append(k)  # appending the result\n\t\t\t\t\n        return sorted(ans)  # finally sorting the array ( given in the question)\n\t\t\nDo Upvote if you like it :))\n
['Python']