8 kyu

Find Maximum and Minimum Values of a List

12,207 of 159,311Goncalerta

Description:

Your task is to make two functions ( max and min, or maximum and minimum, etc., depending on the language ) that receive a list of integers as input, and return the largest and lowest number in that list, respectively. Each function returns one number.

Examples (Input -> Output)

* [4,6,2,1,9,63,-134,566]         -> max = 566, min = -134
* [-52, 56, 30, 29, -54, 0, -110] -> min = -110, max = 56
* [42, 54, 65, 87, 0]             -> min = 0, max = 87
* [5]                             -> min = 5, max = 5

Notes

  • You may consider that there will not be any empty arrays/vectors.
Fundamentals

More By Author:

Check out these other kata created by Goncalerta

Stats:

CreatedJul 4, 2016
PublishedJul 4, 2016
Warriors Trained212841
Total Skips14681
Total Code Submissions307509
Total Times Completed159311
C++ Completions12207
JavaScript Completions52457
Ruby Completions3624
Python Completions57885
C# Completions8035
PHP Completions4065
Elixir Completions622
CoffeeScript Completions45
Java Completions14167
C Completions4182
TypeScript Completions2613
Crystal Completions23
NASM Completions59
Julia Completions85
R Completions293
COBOL Completions25
Lua Completions288
Haskell Completions313
Rust Completions1761
Scala Completions200
Dart Completions185
Total Stars951
% of votes with a positive feedback rating88% of 9436
Total "Very Satisfied" Votes7522
Total "Somewhat Satisfied" Votes1540
Total "Not Satisfied" Votes374
Total Rank Assessments9
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Goncalerta Avatar
  • jhoffner Avatar
  • smepple Avatar
  • hencethus Avatar
  • Unnamed Avatar
  • GiacomoSorbi Avatar
  • Aisenstein Avatar
  • brunolm Avatar
  • smile67 Avatar
  • 10XL Avatar
  • donaldsebleung Avatar
  • Chrono79 Avatar
  • kazk Avatar
  • user5036852 Avatar
  • JohanWiltink Avatar
  • metagn Avatar
  • FArekkusu Avatar
  • monadius Avatar
  • user9644768 Avatar
  • hobovsky Avatar
  • stellartux Avatar
  • ejini战神 Avatar
  • akar-0 Avatar
  • Kacarott Avatar
  • dfhwze Avatar
  • quadratz Avatar
  • KayleighWasTaken Avatar
Ad