66. Saddle Point
Challenge1000 ms256 MBSolved by 0%
A saddle point is a value that is the smallest in its row and at the same time the largest in its column.
Print the value of the first saddle point found, scanning rows top to bottom and each row
left to right. If there is none, print None.
Constraints - `1 ≤ r, c ≤ 100` - `-1000000 ≤ each value ≤ 1000000`
Input
The first line contains two integers r and c.
Each of the next r lines contains c space-separated integers.
Output
Print the value of the first saddle point, scanning rows top to bottom and each row left to right, or None if there is none.
Input3 3
1 2 3
4 5 6
7 8 9
Output7
Notehas the saddle point in the bottom-left corner
Input2 2
1 2
3 4
Output3
Notehas a saddle point in a small matrix
Hint 1Approach
Hint 2Approach
Hint 3Pseudocode
Hint 4Full solution