Ezvor

1198. Find Smallest Common Element in All Rows

MediumArray Preparing judge… LeetCode
ArrayHash TableBinary SearchMatrixCounting

Hints

Hint 1
Notice that each row has no duplicates.
Hint 2
Is counting the frequency of elements enough to find the answer?
Hint 3
Use a data structure to count the frequency of elements.
Hint 4
Find an element whose frequency equals the number of rows.