Find Smallest Common Row Value
Company: SoFi
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Quick Answer: This question evaluates algorithmic problem-solving skills focused on array processing, intersection across multiple sorted sequences, and time/space complexity analysis.
Constraints
- 1 <= number of rows <= 1000
- 1 <= number of columns <= 1000
- All rows have the same length
- Each row is sorted in strictly increasing order
- -10^9 <= matrix[i][j] <= 10^9
Examples
Input: ([[1,2,3,4,5],[2,4,5,8,10],[3,5,7,9,11],[1,3,5,7,9]],)
Expected Output: 5
Explanation: The value 5 appears in every row, and no smaller value does.
Input: ([[-4,-1,0,9]],)
Expected Output: -4
Explanation: With only one row, every value in that row appears in every row. The smallest is -4.
Input: ([[1,2,3],[2,4,6],[4,5,7]],)
Expected Output: -1
Explanation: There is no integer that appears in all three rows.
Input: ([[-3,-1,2,4],[-5,-3,2,8],[-10,-3,0,2]],)
Expected Output: -3
Explanation: Both -3 and 2 appear in every row, so the smallest common value is -3.
Input: ([[7],[7],[7]],)
Expected Output: 7
Explanation: Each row contains only 7, so 7 is the smallest common value.
Input: ([[1,5,10,20],[2,5,12,20],[0,5,15,20]],)