Interview question of the issue #343 of rendezvous with cassidoo.
Given an integer array arr
, return the maximum difference between two successive elements in arr
's sorted form. Return 0 if there's 0 or 1 elements.
Example:
> maxGap([3,6,9,1,2])
> 3
Just pnpm i
to install all dependencies and then pnpm t
to run the tests!