mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-06-07 20:12:13 +00:00
Docs: Update benchmark for google/gemini-3.5-flash
This commit is contained in:
27
tests/2_convex_hull/outputs/google_gemini-3.5-flash.js
Normal file
27
tests/2_convex_hull/outputs/google_gemini-3.5-flash.js
Normal file
@@ -0,0 +1,27 @@
|
||||
export async function findConvexHull(points) {
|
||||
const { sortBy, uniqBy } = await import('https://cdn.jsdelivr.net/npm/lodash-es@4.17.21/+esm');
|
||||
const pts = sortBy(uniqBy(points, ({ x, y }) => `${x},${y}`), ['x', 'y']);
|
||||
|
||||
if (pts.length < 3) return pts;
|
||||
|
||||
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
||||
|
||||
const build = (arr) => {
|
||||
const hull = [];
|
||||
for (const p of arr) {
|
||||
while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) {
|
||||
hull.pop();
|
||||
}
|
||||
hull.push(p);
|
||||
}
|
||||
return hull;
|
||||
};
|
||||
|
||||
const lower = build(pts);
|
||||
const upper = build([...pts].reverse());
|
||||
|
||||
return [...lower.slice(0, -1), ...upper.slice(0, -1)];
|
||||
}
|
||||
export default findConvexHull;
|
||||
// Generation time: 14.861s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user