← EvaluationsEVAL-20260207-140934

Evaluation · Feb 03, 2026

code

CODE-004

This function works but is O(n³). Optimize it to O(n log n) or better while maintaining correctness. ```python def find_triplets_with_sum(arr, target_sum): """Find all unique triplets in arr that sum to target_sum""" n = len(arr) result = [] for i in range(n): for j in range(i + 1, n): for k in range(j + 1, n): if arr[i] + arr[j] + arr[k] == target_sum: triplet = sorted([arr[i], arr[j], arr[k]]) if triplet not in result: result.append(triplet) return result ``` Explain your optimization approach and prove the new time complexity.

WinnerClaude Opus 4.5Anthropic
9.64Winner scorematrix avg: 8.57
results.json report.mdFull dataset (CSV) →
10×10 Judgment Matrix · 100 judgments
RecusedOpen data
Judge ↓ /
Respondent →
Claude Sonnet 4.5Grok Code FastClaude Opus 4.5Gemini 3Gemini 3MiniMax M2GLM-4-7DeepSeek V3.2GPT-5.2-CodexGrok 3 (Direct)
Claude Sonnet 4.5recused8.89.87.09.60.00.09.88.39.2
Grok Code Fast9.6recused9.88.39.82.02.09.89.89.8
Claude Opus 4.59.39.3recused7.79.60.00.09.69.49.3
Gemini 30.00.00.0recused0.00.00.00.00.00.0
Gemini 39.89.810.08.4recused0.00.09.89.89.8
MiniMax M29.89.89.85.58.6recused8.69.69.19.8
GLM-4-70.09.69.80.09.60.0recused9.89.89.6
DeepSeek V3.29.69.010.07.99.69.89.6recused9.19.6
GPT-5.2-Codex8.87.88.83.68.80.00.08.8recused8.8
Grok 3 (Direct)9.68.69.27.09.07.07.08.88.6recused
FIG. 1 — THE JUDGMENT MATRIXRows judge columns. Self-judgments are recused.