codingforeveryone/js

new-member-25 Between Extremes

Closed this issue · 3 comments

Given an array of numbers, return the difference between the largest and smallest values.

For example:

[23, 3, 41, 21, 16] should return 20 (i.e., 23 - 3).

[1, 434, 555, 34, 112] should return 554 (i.e., 555 - 1).

The array will contain a minimum of two elements.

This is the link to Codewars.

Needs edge and random test cases.

Right now it also accepts sloppy solutions, but maybe that is ok with you,
aiming at creating a beginner kata with little to no emphasis on
performances.

On 3 March 2016 at 20:44, TroyMaeder notifications@github.com wrote:

Given an array of numbers, return the difference between the largest and
smallest values.

For example:

[23, 3, 41, 21, 16] should return 20 (i.e., 23 - 3).

[1, 434, 555, 34, 112] should return 554 (i.e., 555 - 1).

The array will contain a minimum of two elements.

This is the link to Codewars
http://www.codewars.com/kata/56d19b2ac05aed1a20000430.


Reply to this email directly or view it on GitHub
#102.

Hi @GiacomoSorbi,

I added some random test cases. Do you recommend any more?

With the sloppy solutions, that is fair enough. I didn't intend to make a more advanced kata. This is the first kata I've ever created and I'm a beginner myself.

I've also just created a new kata. If you care to take the time to check it out and give me some feedback.

http://www.codewars.com/kata/56ed5f13c4e5d6c5b3000745

Thanks.

Hi Troy, no one had tried this for a while, and I did your last paperboy issue and thought I should leave it for someone else. Created a pull request with the solution in if you could merge it. Thanks!