# HackerRank Min and Max problem solution in python

In this Min and Max problem, You are given a 2-D array with dimensions N X M. Your task is to perform the min function over axis 1 and then find the max of that.

## Problem solution in Python 2 programming.

```import numpy
l=map(int,raw_input().split())
m=[]
for i in range(l[0]):
m.append(map(int,raw_input().split()))
m=numpy.array(m)
print max(numpy.min(m,axis=1))    ```

## Problem solution in Python 3 programming.

```import numpy

n,m=map(int,input().split())

lista=[list(map(int,input().split())) for i in range(n)]

ar=numpy.array(lista)

print(max(numpy.min(ar,axis=1)))```

### Problem solution in pypy programming.

```# Enter your code here. Read input from STDIN. Print output to STDOUT
import numpy
N, M = map(int, raw_input().split())
myarr = []
for _ in range(N):
myarr.append(map(int,raw_input().split()))
print numpy.max(numpy.min(myarr, axis = 1), axis = 0)```

### Problem solution in pypy3 programming.

```# Enter your code here. Read input from STDIN. Print output to STDOUT
N, M= [int (i) for i in input().split()]
arr=[]
for i in range(N):
arr.append( [int(x) for x in input().split()]  )
ma=arr[0][0]
for i in range(N):
mi=arr[i][0]
for j in range(1,M):
if (arr[i][j]<mi):
mi=arr[i][j]
if (mi>ma):
ma=mi
print(ma)```