7 kyu

max diff - easy

4,698 of 13,195Tefferson

Description:

You must implement a function that returns the difference between the largest and the smallest value in a given list / array (lst) received as the parameter.

  • lst contains integers, that means it may contain some negative numbers
  • if lst is empty or contains a single element, return 0
  • lst is not sorted
[1, 2, 3, 4]   //  returns 3 because 4 -   1  == 3
[1, 2, 3, -4]  //  returns 7 because 3 - (-4) == 7

Have fun!

Mathematics
Lists
Arrays
Fundamentals

More By Author:

Check out these other kata created by Tefferson

Stats:

CreatedJan 26, 2017
PublishedJan 26, 2017
Warriors Trained15877
Total Skips404
Total Code Submissions29843
Total Times Completed13195
JavaScript Completions5358
Python Completions4698
C# Completions797
F# Completions86
Java Completions1992
Rust Completions370
Ruby Completions154
C Completions113
COBOL Completions4
Total Stars90
% of votes with a positive feedback rating92% of 1776
Total "Very Satisfied" Votes1543
Total "Somewhat Satisfied" Votes197
Total "Not Satisfied" Votes36
Total Rank Assessments28
Average Assessed Rank
7 kyu
Highest Assessed Rank
7 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Tefferson Avatar
  • Dentzil Avatar
  • imjasonmiller Avatar
  • gustavorborba Avatar
  • rowcased Avatar
  • hobovsky Avatar
  • Glyxerine Avatar
  • ejini战神 Avatar
  • davidies Avatar
  • akar-0 Avatar
  • farhanaditya Avatar
Ad