# Python: Find a number in a given matrix which is maximum in its column and minimum in its row

## Python Basic - 1: Exercise-104 with Solution

Write a Python program to find a number in a given matrix that is maximum in its column and minimum in its row.

**Sample Solution:**

**Python Code:**

```
# Number in a Matrix: Maximum in its column and minimum in its row.
def matrix_number(matrix):
result = set(map(min, matrix)) & set(map(max, zip(*matrix)))
return list(result)
m1 = [[1,2], [2,3]]
print("Original matrix:",m1)
print("Number in the said matrix which is maximum in its column and minimum in its row:")
print(matrix_number(m1))
m1 = [[1,2,3], [3,4,5]]
print("\nOriginal matrix:",m1)
print("Number in the said matrix which is maximum in its column and minimum in its row:")
print(matrix_number(m1))
m1 = [[7,5,6], [3,4,4], [6,5,7]]
print("\nOriginal matrix:",m1)
print("Number in the said matrix which is maximum in its column and minimum in its row:")
print(matrix_number(m1))
```

Sample Output:

Original matrix: [[1, 2], [2, 3]] Number in the said matrix which is maximum in its column and minimum in its row: [2] Original matrix: [[1, 2, 3], [3, 4, 5]] Number in the said matrix which is maximum in its column and minimum in its row: [3] Original matrix: [[7, 5, 6], [3, 4, 4], [6, 5, 7]] Number in the said matrix which is maximum in its column and minimum in its row: [5]

**Flowchart:**

**Python Code Editor:**

**Have another way to solve this solution? Contribute your code (and comments) through Disqus.**

**Previous:** Write a Python program to check whether two given lines are parallel or not.

**Next:** Write a Python program to check whether a given sequence is linear, quadratic or cubic.

**What is the difficulty level of this exercise?**

Test your Programming skills with w3resource's quiz.

**Weekly Trends**- Python Interview Questions and Answers: Comprehensive Guide
- Scala Exercises, Practice, Solution
- Kotlin Exercises practice with solution
- MongoDB Exercises, Practice, Solution
- SQL Exercises, Practice, Solution - JOINS
- Java Basic Programming Exercises
- SQL Subqueries
- Adventureworks Database Exercises
- C# Sharp Basic Exercises
- SQL COUNT() with distinct
- JavaScript String Exercises
- JavaScript HTML Form Validation
- Java Collection Exercises
- SQL COUNT() function
- SQL Inner Join