codingforeveryone/js

new-member-16

Closed this issue · 1 comments

Greatest Difference

You will be given an array of arrays. Each nested array will contain a set of increasing positive integers. Your function should return the value of the greatest difference between any two sequential numbers within the same array.

For example...

var sampleArr1 = [
                  [4, 7, 8, 15, 22, 33, 35, 41, 53],
                  [23, 44, 67, 68, 99, 102],
                  [199, 203, 205, 213, 218],
                  [10, 12, 77, 133, 150]
                ];

var sampleArr2 = [
                  [361, 403, 425, 480, 576, 672, 730, 733, 805, 826],
                  [896, 982],
                  [303, 399, 489, 490, 499, 515, 578],
                  [553, 555, 646, 692, 697],
                  [272, 338, 353, 432, 529, 553, 565]
                ];

greatestDiff(sampleArr1); // Returns 65
greatestDiff(sampleArr2; // Returns 97

Hi @thevjm. I think I'd like to take this one on!