Max Min Difference

Published by Someone1 in

Given an array of integers, return the difference between the largest and smallest integers in the array .

Examples

Diff([10, 15, 20, 2, 10, 6]) ➞ 18
// 20 - 2 = 18

Diff([-3, 4, -9, -1, -2, 15]) ➞ 24
// 15 - (-9) = 24

Diff([4, 17, 12, 2, 10, 2]) ➞ 15

Notes

N/A

Watch a quick demo on how Edabit works.