Skip to content

Commit

Permalink
apply requested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
tlgimenes committed Jun 13, 2022
1 parent 7f8aafa commit 8e617fa
Showing 1 changed file with 0 additions and 13 deletions.
13 changes: 0 additions & 13 deletions packages/api/src/platforms/vtex/utils/orderStatistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,6 @@
* More info at: https://en.wikipedia.org/wiki/Order_statistic
*/

// O(n) search to find the max of an array
export const max = <T>(array: T[], cmp: (a: T, b: T) => number) => {
let best = 0

for (let curr = 1; curr < array.length; curr++) {
if (cmp(array[best], array[curr]) < 0) {
best = curr
}
}

return array[best]
}

// O(n) search to find the max of an array
export const min = <T>(array: T[], cmp: (a: T, b: T) => number) => {
let best = 0
Expand Down

0 comments on commit 8e617fa

Please sign in to comment.