Skip to content
Programmingoneonone
Programmingoneonone
  • Home
  • CS Subjects
    • IoT ? Internet of Things
    • Digital Communication
    • Human Values
  • Programming Tutorials
    • C Programming
    • Data structures and Algorithms
    • 100+ Java Programs
    • 100+ C Programs
  • HackerRank Solutions
    • HackerRank Algorithms Solutions
    • HackerRank C problems solutions
    • HackerRank C++ problems solutions
    • HackerRank Java problems solutions
    • HackerRank Python problems solutions
Programmingoneonone

HackerRank Min and Max problem solution in python

YASH PAL, 31 July 2024

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.

HackerRank Min and Max solution in python

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)

coding problems solutions Python Solutions

Post navigation

Previous post
Next post

Pages

  • About US
  • Contact US
  • Privacy Policy

Programing Practice

  • C Programs
  • java Programs

HackerRank Solutions

  • C
  • C++
  • Java
  • Python
  • Algorithm

Other

  • Leetcode Solutions
  • Interview Preparation

Programming Tutorials

  • DSA
  • C

CS Subjects

  • Digital Communication
  • Human Values
  • Internet Of Things
  • YouTube
  • LinkedIn
  • Facebook
  • Pinterest
  • Instagram
©2025 Programmingoneonone | WordPress Theme by SuperbThemes