Live Batches
Masterclasses
Menu
Free Courses
Account
Login / Sign Up

Find Maximum / Minimum in Array

Easy Acceptance 75.00% Points 20.00

You are given an array of integers. Your task is to find and return the maximum and minimum elements present in the array.

Examples
Example 1

Example 1

Input: arr[] = [1 5 6 7 9]

Output: Minimum = 1, Maximum = 9

Explanation: Not Needed

Example 2

Example 2

Input: arr[] = [85 45 98 63 77]

Output: Minimum-45, Maximum-98

Explanation: Not Needed

Hints
Hint 1
N/A
Constraints
  • 1 < n < 105
  • -109 < arr[i] < 109
Companies
Apple Zomato Media.net
Topics
Recursion
Solution.cs C#JavaPythonC++Javascript

Unlock the code editor

Sign in to write, run, and submit your solution against the full test suite.

  • Run code against sample & hidden test cases
  • Save submissions and track your streak
  • Compare with editorial & community solutions