Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Can we use a frequency array?
Pre-process the positions of the values in the matrix.
Traverse the array and increment the corresponding row and column frequency using the pre-processed positions.
If the row frequency becomes equal to the number of columns, or vice-versa return the current index.