generate new test that did already exist & update all module snippets with declaration
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
module.exports = arr => {
|
||||
module.exports = median = arr => {
|
||||
const mid = Math.floor(arr.length / 2),
|
||||
nums = [...arr].sort((a, b) => a - b);
|
||||
return arr.length % 2 !== 0 ? nums[mid] : (nums[mid - 1] + nums[mid]) / 2;
|
||||
|
||||
Reference in New Issue
Block a user