HackerRank Min and Max problem solution in Python YASH PAL, 31 July 202417 January 2026 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.minThe tool min returns the minimum value along a given axis.import numpy my_array = numpy.array([[2, 5], [3, 7], [1, 3], [4, 0]]) print numpy.min(my_array, axis = 0) #Output : [1 0] print numpy.min(my_array, axis = 1) #Output : [2 3 1 0] print numpy.min(my_array, axis = None) #Output : 0 print numpy.min(my_array) #Output : 0 By default, the axis value is None. Therefore, it finds the minimum over all the dimensions of the input array.maxThe tool max returns the maximum value along a given axis.import numpy my_array = numpy.array([[2, 5], [3, 7], [1, 3], [4, 0]]) print numpy.max(my_array, axis = 0) #Output : [4 7] print numpy.max(my_array, axis = 1) #Output : [5 7 3 4] print numpy.max(my_array, axis = None) #Output : 7 print numpy.max(my_array) #Output : 7 By default, the axis value is None. Therefore, it finds the maximum over all the dimensions of the input array.HackerRank Min and Max problem solution in Python 2.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)) Min and Max solution in Python 3.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) coding problems solutions Hackerrank Problems Solutions Python Solutions HackerRankPython