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
Hints
Four rungs, in order. The last two open once you have submitted an attempt. A wrong one counts.
Hint 1Where to start
Hint 2The approachOpen hint 1 first. This one carries on from it.
Hint 3PseudocodeOpen hint 2 first. This one carries on from it.
Hint 4Full solutionOpen hint 3 first. This one carries on from it.