mirror of
https://github.com/multipleof4/lynchmark.git
synced 2026-01-14 08:37:56 +00:00
Docs: Update benchmark for deepseek/deepseek-v3.2
This commit is contained in:
21
tests/2_convex_hull/outputs/deepseek_deepseek-v3.2.js
Normal file
21
tests/2_convex_hull/outputs/deepseek_deepseek-v3.2.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const findConvexHull = async (points) => {
|
||||
const _ = await import('https://cdn.skypack.dev/lodash');
|
||||
const sorted = _.uniqBy(points, p => `${p.x},${p.y}`).sort((a, b) => a.x - b.x || a.y - b.y);
|
||||
if (sorted.length < 3) return sorted;
|
||||
const cross = (o, a, b) => (a.x - o.x) * (b.y - o.y) - (a.y - o.y) * (b.x - o.x);
|
||||
const buildHull = (pts) => {
|
||||
const hull = [];
|
||||
for (const p of pts) {
|
||||
while (hull.length >= 2 && cross(hull[hull.length - 2], hull[hull.length - 1], p) <= 0) hull.pop();
|
||||
hull.push(p);
|
||||
}
|
||||
hull.pop();
|
||||
return hull;
|
||||
};
|
||||
const lower = buildHull(sorted);
|
||||
const upper = buildHull(sorted.reverse());
|
||||
return lower.concat(upper);
|
||||
};
|
||||
export default findConvexHull;
|
||||
// Generation time: 9.132s
|
||||
// Result: PASS
|
||||
Reference in New Issue
Block a user