Easiest C /C++ / Python3 / Java / Python With Hash or without beats 100%
Intuition\n\n\n\n\n\nC++ []\nclass Solution {\npublic:\n    vector<int> intersection(vector<vector<int>>& nums) {\n        map<int, int> mp;\n        int len = 
# Intuition\n![Screenshot 2024-03-13 073511.png](https://assets.leetcode.com/users/images/b6791ccb-a115-4120-b283-458ac0630500_1710295591.277407.png)\n![Screenshot 2024-03-13 073456.png](https://assets.leetcode.com/users/images/da5f5b8e-933f-4300-89fb-1d285f1efbd0_1710295596.1679344.png)\n![Screenshot 2024-03-13 073446.png](https://assets.leetcode.com/users/images/2e5fb266-c4e1-48c2-9886-7ae3915d8054_1710295602.4527507.png)\n![Screenshot 2024-03-13 073438.png](https://assets.leetcode.com/users/images/a3510d77-cfd2-4b95-bd61-acd95858d744_1710295607.6717644.png)\n![Screenshot 2024-03-13 073423.png](https://assets.leetcode.com/users/images/432ae8a6-7bac-4bda-b7dc-453a092cda8f_1710295612.7126966.png)\n```C++ []\nclass Solution {\npublic:\n    vector<int> intersection(vector<vector<int>>& nums) {\n        map<int, int> mp;\n        int len = nums.size();\n        for (auto& x : nums)\n            for (auto& y : x)\n                mp[y]++;\n        vector<int> res;\n        for (auto& [key, value] : mp)\n            if (value == len)\n                res.push_back(key);\n        return res;\n    }\n};\n```\n```python3 []\nclass Solution:\n    def intersection(self, nums: List[List[int]]) -> List[int]:\n        n = len(nums)\n        ans = set(nums[0])\n        for i in range(1, n):\n            ans = ans.intersection(set(nums[i]))\n        \n        ans_lst = list(ans)\n        ans_lst.sort()\n        return ans_lst\n```\n```C++ []\nclass Solution {\npublic:\n    vector<int> intersection(vector<vector<int>>& nums) {\n        ios_base::sync_with_stdio(false);\n        cin.tie(NULL);\n        cout.tie(NULL);\n        vector<int> ans(1001, 0);\n        int n = nums.size();\n        for(int i =0; i < n; i++)\n            for(auto it : nums[i])\n                ans[it]++;\n\n        vector<int> finalans;\n        for(int i =1; i <= 1000; i++)\n            if(ans[i] == n)\n                finalans.push_back(i);          \n        \n        return finalans;\n    }\n};\n```\n```java []\nclass Solution {\n    public List<Integer> intersection(int[][] nums) {\n        List<Integer> ans = new ArrayList<>();\n        int[] count  = new int[1001];\n        for(int[] arr : nums)\n            for(int i : arr)\n                count[i]++;\n\n       for(int i = 0; i <count.length; i++)\n           if(count[i]  == nums.length)\n               ans.add(i); \n\n        return ans;\n    }\n}\n```\n```python []\nclass Solution(object):\n    def intersection(self, nums):\n        """\n        :type nums: List[List[int]]\n        :rtype: List[int]\n        """\n        ans = set(nums[0])\n        for row in nums:\n            row_set = set(row)\n            ans = row_set & ans\n\n        return sorted(list(ans))\n```\n```C []\n/**\n * Note: The returned array must be malloced, assume caller calls free().\n */\nint* intersection(int** nums, int numsSize, int* numsColSize, int* returnSize) {\n    int arr[1001] = {0};\n    for (int i = 0; i < numsSize; i++)\n        for (int c = 0; c < numsColSize[i]; c++)\n            arr[nums[i][c]]++;\n    int* res = (int*)malloc(sizeof(int) * 1001);\n    int t = 0;\n    for (int x = 0; x < 1001; x++)\n        if (arr[x] == numsSize)\n            res[t++] = x;\n    *returnSize = t;\n    return res;\n}\n```\n\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n    O(n)\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n    O(1001) --> O(1)\n# Code\n```\n/**\n * Note: The returned array must be malloced, assume caller calls free().\n */\nint* intersection(int** nums, int numsSize, int* numsColSize, int* returnSize) {\n    int arr[1001] = {0};\n    for (int i = 0; i < numsSize; i++)\n        for (int c = 0; c < numsColSize[i]; c++)\n            arr[nums[i][c]]++;\n    int* res = (int*)malloc(sizeof(int) * 1001);\n    int t = 0;\n    for (int x = 0; x < 1001; x++)\n        if (arr[x] == numsSize)\n            res[t++] = x;\n    *returnSize = t;\n    return res;\n}\n```\n# Please Upvote if it\'s useful for you .. Thanks..\n![th.jpeg](https://assets.leetcode.com/users/images/e1bd4265-4e91-4b63-bb15-931a8698f007_1710295738.6542118.jpeg)\n
['Array', 'Hash Table', 'C', 'Sorting', 'Counting', 'Python', 'C++', 'Java', 'Python3', 'C#']