0
0
GGGiovanny Gongora
Returns the n maximum elements from the provided array.
const maxN = (arr: Array<number>, n: number = 1) => [...arr].sort((a, b) => b - a).slice(0, n);
0
0
GGGiovanny Gongora
Returns the n maximum elements from the provided array.
const maxN = (arr: Array<number>, n: number = 1) => [...arr].sort((a, b) => b - a).slice(0, n);