Maximum Different of Int-Array in Java
The challenge
You must implement a function that returns the difference between the biggest and the smallest value in a list(lst) received as a parameter.
The list(lst
) contains integers, which means it may contain some negative numbers.
If the list is empty or contains a single element, return 0
.
The list(lst
) is not sorted.
The solution in Java code
Option 1:
Option 2:
Option 3:
Test cases to validate our solution
|
|