FlareStart
HomeNewsHow ToSources
FlareStart

Where developers start their day. All the tech news & tutorials that matter, in one place.

Quick Links

  • Home
  • News
  • Tutorials
  • Sources
  • Privacy Policy

Connect

© 2026 FlareStart. All rights reserved.

Back to articles
To Find the max & min elements in a array
NewsProgramming Languages

To Find the max & min elements in a array

via Dev.toAbirami Prabhakar3h ago

here to find the minimum and maximum element in a array without using the minimum and maximum function, we are comparing all the elements to its previous element find the max and min value and then, the elements are returned back in a list with a use of simple for loop Intially, min -> arr[0] max -> arr[0] in a for loop -> i++ in a linear span compared to its element in list in loop arr[i] >< min or arr[i] >< max lets have a look into the code block, def minmax ( arr ): min = arr [ 0 ] max = arr [ 0 ] for i in range ( 1 , len ( arr )): if arr [ i ] < min : min = arr [ i ] elif arr [ i ] > max : max = arr [ i ] return [ min , max ] arr = [ 12 , 3 , 15 , 7 , 9 ] print ( minmax ( arr ))

Continue reading on Dev.to

Opens in a new tab

Read Full Article
0 views

Related Articles

The Algorithm That Rewrote 56 Years of Math
News

The Algorithm That Rewrote 56 Years of Math

Medium Programming • 26m ago

What Are The Fundamentals Of Forex Trading?
News

What Are The Fundamentals Of Forex Trading?

Medium Programming • 41m ago

CyCTF Luxor Qualifications 2026 — Mobile Challenges Writeup
News

CyCTF Luxor Qualifications 2026 — Mobile Challenges Writeup

Medium Programming • 1h ago

My Journey as a Full Stack Developer in India
News

My Journey as a Full Stack Developer in India

Medium Programming • 1h ago

How Junior and Senior Engineers Approach a Production Bug Differently
News

How Junior and Senior Engineers Approach a Production Bug Differently

Medium Programming • 1h ago

Discover More Articles