frequency count / count sort w/ array || C++ || 100% fast (3ms)
Since the numbers in each array are distinct and the range these numbers are in is limited to 1 to 1000 we can just use a frequency count. The answer is all the
Since the numbers in each array are distinct and the range these numbers are in is limited to 1 to 1000 we can just use a frequency count. The answer is all these numbers that are found as often as the number of arrays.\n\n```\n    vector<int> intersection(vector<vector<int>>& nums) {\n        array<int, 1001> counts = {};\n        for (const auto& as : nums) {\n            for (int a : as) {\n                ++counts[a];\n            }\n        }\n        vector<int> ans;\n        for (int i = 0; i < size(counts); ++i) {\n            if (counts[i] == size(nums)) ans.push_back(i);\n        }\n        return ans;\n    }\n```
['Array', 'C', 'Counting Sort']