Skip to content

2161-partition-array-according-to-given-pivot

DevGod
DevGod
Vtuber
/**
* @param {number[]} nums
* @param {number} pivot
* @return {number[]}
*/
var pivotArray = function (nums, pivot) {
return Object.values(Object.groupBy(nums, (el) => Math.sign(el - pivot) + 1)).flat();
}