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
Finding Minimum and Maximum in an Array using Python
NewsProgramming Languages

Finding Minimum and Maximum in an Array using Python

via Dev.to TutorialMohammed Azim J3h ago

Problem Statement Given an array arr[], the task is to find the minimum and maximum elements present in the array. Examples Input: arr = [1, 4, 3, 5, 8, 6] Output: [1, 8] Input: arr = [12, 3, 15, 7, 9] Output: [3, 15] Objective • Identify the smallest element • Identify the largest element • Return both values as output Approach 1: Using Loop (Manual Method) This approach involves: • Initializing two variables: o minimum → first element o maximum → first element • Iterating through the array • Updating values when a smaller or larger element is found Algorithm Start with the first element as both min and max Traverse the array For each element: o If it is smaller than current min → update min o If it is larger than current max → update max Return both values ________________________________________ Python Code arr = [1, 4, 3, 5, 8, 6] minimum = arr[0] maximum = arr[0] for i in arr: if i < minimum: minimum = i if i > maximum: maximum = i print("Minimum:", minimum) print("Maximum:", maxi

Continue reading on Dev.to Tutorial

Opens in a new tab

Read Full Article
0 views

Related Articles

News

Mechanics vs Understanding

Medium Programming • 1h ago

Flames of Desire
News

Flames of Desire

Medium Programming • 3h ago

The Night I Ran Out of Tokens
News

The Night I Ran Out of Tokens

Medium Programming • 4h ago

News

Why Judge Calibration Matters: Sonnet vs Opus — a Case Study

Medium Programming • 4h ago

News

The Big Code Challenge : Round 1

Medium Programming • 4h ago

Discover More Articles