Tested prompt · Coding
Merge overlapping intervals: every AI model's reply, tested
We sent this everyday coding prompt to all 16 models in llmwise, the same way the app sends a message, and checked every reply the same way. Here's each one as it came, with whether it passed, what it cost and how long it took.
Based on 16 of our test runs on , through OpenRouter with the app's own prompt and settings. Updated .
Short answer
All 16 models passed this coding prompt's check (tests). The cheapest reply that passed was GPT-6 Luna's, at $0.00011; the fastest, GLM 5.3's in 0.8 s. The dearest reply, Claude Fable 5.1's, cost 194 times as much ($0.0214).
The prompt, as sent, and its check
Checked by tests, the same way for every model.
Merge overlapping intervals (everyday)
Write a JavaScript function mergeIntervals(intervals) that takes an array of [start, end] pairs (numbers, start ≤ end, in any order) and returns a new array in which overlapping or touching intervals are merged, sorted by start. [1, 3] and [3, 5] touch, so they merge into [1, 5]. Don't change the input array. Reply with the whole function in one ```javascript code block: plain JavaScript for Node.js 22, no imports, no TypeScript.
The reply's mergeIntervals runs against these 7 tests; it passes when all of them do.
mergeIntervals([[1, 3], [2, 6], [8, 10], [15, 18]]) // → [[1, 6], [8, 10], [15, 18]]
mergeIntervals([[1, 4], [4, 5]]) // → [[1, 5]]
mergeIntervals([]) // → []
mergeIntervals([[5, 7], [1, 2]]) // → [[1, 2], [5, 7]]
mergeIntervals([[1, 10], [2, 3], [4, 5]]) // → [[1, 10]]
mergeIntervals([[1, 2], [2, 2], [2, 3]]) // → [[1, 3]]
(() => { const input = [[3, 4], [1, 2]]; mergeIntervals(input); return input; })() // → [[3, 4], [1, 2]]Exactly what this prompt's replies are checked against, with every other prompt of our test runs.
Every model's result
All 16 models on this prompt, in catalog order.
| Model | Result | Cost | Time | Reply |
|---|---|---|---|---|
| Claude Fable 5.1Anthropic | Passed: All 7 tests passed. | $0.0214 | 5.3 s | 275 tokens |
| Claude Opus 5.5Anthropic | Passed: All 7 tests passed. | $0.0077 | 3.7 s | 234 tokens |
| Claude Sonnet 5.5Anthropic | Passed: All 7 tests passed. | $0.0033 | 1.4 s | 180 tokens |
| Claude Sonnet 5Anthropic | Passed: All 7 tests passed. | $0.0034 | 2.7 s | 216 tokens |
| Claude Haiku 4.5Anthropic | Passed: All 7 tests passed. | $0.0017 | 2.0 s | 239 tokens |
| GPT-6 AstraOpenAI | Passed: All 7 tests passed. | $0.0108 | 2.6 s | 127 tokens |
| GPT-6 SolOpenAI | Passed: All 7 tests passed. | $0.0022 | 1.7 s | 130 tokens |
| GPT-6 LunaOpenAI | Passed: All 7 tests passed. | $0.00011 | 1.5 s | 130 tokens |
| Gemini 3.1 Pro (preview)Google | Passed: All 7 tests passed. | $0.0103 | 8.6 s | 196 tokens |
| Gemini 3.8 FlashGoogle | Passed: All 7 tests passed. | $0.0012 | 3.8 s | 229 tokens |
| DeepSeek V4.1 FlashDeepSeek | Passed: All 7 tests passed. | $0.00014 | 1.5 s | 187 tokens |
| DeepSeek V4 ProDeepSeek | Passed: All 7 tests passed. | $0.00048 | 6.6 s | 174 tokens |
| Grok 4.7xAI | Passed: All 7 tests passed. | $0.0025 | 3.8 s | 187 tokens |
| Kimi K3Moonshot | Passed: All 7 tests passed. | $0.0036 | 2.0 s | 148 tokens |
| GLM 5.3Z.ai | Passed: All 7 tests passed. | $0.00082 | 0.8 s | 113 tokens |
| GLM 5.3 FlashZ.ai | Passed: All 7 tests passed. | $0.00024 | 9.6 s | 205 tokens |
Cost: what OpenRouter charged us for the reply. Time: from sending to the whole reply. Reply: its length in tokens, thinking not counted. In llmwise you pay per message, not per token: each of these replies counted as one message on Pro.
Every reply
Every reply passed: here they are from the cheapest up.
GPT-6 Luna
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; if (!last || start > last[1]) { merged.push([start, end]); } else { last[1] = Math.max(last[1], end); } } return merged; } ```449 tokens in, 130 out · 1.5 s · $0.0001 · 1 message on Pro · answered by openai/gpt-6-luna via OpenAI ·
DeepSeek V4.1 Flash
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (intervals.length === 0) return []; const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const merged = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const [start, end] = sorted[i]; const last = merged[merged.length - 1]; if (start <= last[1]) { // overlapping or touching (start === last[1]) -> extend if (end > last[1]) last[1] = end; } else { merged.push([start, end]); } } return merged; } ```489 tokens in, 199 out (12 of them reasoning) · 1.5 s · $0.0001 · 1 message on Pro · answered by deepseek/deepseek-v4.1-flash via Wafer ·
GLM 5.3 Flash
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { // Sort a copy by start so the input array is left unchanged const sorted = [...intervals].sort((a, b) => a[0] - b[0]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; // Merge when overlapping ([1,4] & [2,5]) or touching ([1,3] & [3,5]) if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { merged.push([start, end]); } } return merged; } ``` Example: `mergeIntervals([[5, 7], [1, 3], [3, 5], [8, 10]])` → `[[1, 7], [8, 10]]`.463 tokens in, 287 out (82 of them reasoning) · 9.6 s · $0.0002 · 1 message on Pro · answered by z-ai/glm-5.3-flash via Wafer ·
DeepSeek V4 Pro
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (intervals.length === 0) return []; const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const merged = [sorted[0].slice()]; for (let i = 1; i < sorted.length; i++) { const last = merged[merged.length - 1]; const [start, end] = sorted[i]; if (start <= last[1]) { if (end > last[1]) last[1] = end; } else { merged.push([start, end]); } } return merged; } ```461 tokens in, 457 out (283 of them reasoning) · 6.6 s · $0.0005 · 1 message on Pro · answered by deepseek/deepseek-v4-pro-0813 via StreamLake ·
GLM 5.3
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = [...intervals].sort((a, b) => a[0] - b[0]); const result = []; for (const [start, end] of sorted) { const last = result[result.length - 1]; if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { result.push([start, end]); } } return result; } ```486 tokens in, 114 out (1 of them reasoning) · 0.8 s · $0.0008 · 1 message on Pro · answered by z-ai/glm-5.3 via Wafer ·
Gemini 3.8 Flash
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!intervals || intervals.length <= 1) { return intervals ? intervals.map(interval => [...interval]) : []; } // Clone and sort by start time, breaking ties by end time const sorted = intervals .map(interval => [...interval]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const merged = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const current = sorted[i]; const lastMerged = merged[merged.length - 1]; // Overlapping or touching intervals if (current[0] <= lastMerged[1]) { lastMerged[1] = Math.max(lastMerged[1], current[1]); } else { merged.push(current); } } return merged; } ```477 tokens in, 229 out · 3.8 s · $0.0012 · 1 message on Pro · answered by google/gemini-3.8-flash via Google ·
Claude Haiku 4.5
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (intervals.length === 0) return []; // Sort intervals by start time, then by end time const sorted = intervals.map(interval => [...interval]).sort((a, b) => { return a[0] - b[0] || a[1] - b[1]; }); const merged = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const current = sorted[i]; const last = merged[merged.length - 1]; // If current interval overlaps or touches the last merged interval if (current[0] <= last[1]) { // Merge by extending the end of the last interval last[1] = Math.max(last[1], current[1]); } else { // No overlap, add as new interval merged.push(current); } } return merged; } ```481 tokens in, 239 out · 2.0 s · $0.0017 · 1 message on Pro · answered by anthropic/claude-haiku-4.5 via Amazon Bedrock ·
GPT-6 Sol
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { merged.push([start, end]); } } return merged; } ```449 tokens in, 130 out · 1.7 s · $0.0022 · 1 message on Pro · answered by openai/gpt-6-sol via OpenAI ·
Grok 4.7
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!intervals || intervals.length === 0) return []; const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const merged = [[sorted[0][0], sorted[0][1]]]; for (let i = 1; i < sorted.length; i++) { const [start, end] = sorted[i]; const last = merged[merged.length - 1]; if (start <= last[1]) { if (end > last[1]) last[1] = end; } else { merged.push([start, end]); } } return merged; } ```1,683 tokens in, 306 out (119 of them reasoning) · 3.8 s · $0.0025 · 1 message on Pro · answered by x-ai/grok-4.7 via xAI ·
Claude Sonnet 5.5
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const result = []; for (const [start, end] of sorted) { const last = result[result.length - 1]; if (last && start <= last[1]) { if (end > last[1]) last[1] = end; } else { result.push([start, end]); } } return result; } ```623 tokens in, 180 out · 1.4 s · $0.0033 · 1 message on Pro · answered by anthropic/claude-sonnet-5.5 via Anthropic ·
Claude Sonnet 5
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!intervals || intervals.length === 0) return []; const sorted = intervals .map(([a, b]) => [a, b]) .sort((x, y) => x[0] - y[0]); const result = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const [start, end] = sorted[i]; const last = result[result.length - 1]; if (start <= last[1]) { last[1] = Math.max(last[1], end); } else { result.push([start, end]); } } return result; } ```619 tokens in, 216 out · 2.7 s · $0.0034 · 1 message on Pro · answered by anthropic/claude-sonnet-5 via Claude Platform on AWS ·
Kimi K3
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { merged.push([start, end]); } } return merged; } ```536 tokens in, 152 out (4 of them reasoning) · 2.0 s · $0.0036 · 1 message on Pro · answered by moonshotai/kimi-k3 via Together ·
Claude Opus 5.5
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!Array.isArray(intervals) || intervals.length === 0) return []; const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const result = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const last = result[result.length - 1]; const [start, end] = sorted[i]; if (start <= last[1]) { if (end > last[1]) last[1] = end; } else { result.push([start, end]); } } return result; } ```621 tokens in, 234 out · 3.7 s · $0.0077 · 1 message on Pro · answered by anthropic/claude-opus-5.5 via Claude Platform on AWS ·
Gemini 3.1 Pro
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!intervals || intervals.length === 0) { return []; } const sorted = [...intervals].sort((a, b) => a[0] - b[0]); const result = []; let current = [sorted[0][0], sorted[0][1]]; for (let i = 1; i < sorted.length; i++) { const next = sorted[i]; if (next[0] <= current[1]) { current[1] = Math.max(current[1], next[1]); } else { result.push(current); current = [next[0], next[1]]; } } result.push(current); return result; } ```477 tokens in, 780 out (584 of them reasoning) · 8.6 s · $0.0103 · 1 message on Pro · answered by google/gemini-3.1-pro-preview via Google ·
GPT-6 Astra
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { const sorted = intervals.map(([start, end]) => [start, end]); sorted.sort((a, b) => a[0] - b[0]); const merged = []; for (const [start, end] of sorted) { const last = merged[merged.length - 1]; if (last && start <= last[1]) { last[1] = Math.max(last[1], end); } else { merged.push([start, end]); } } return merged; } ```449 tokens in, 127 out · 2.6 s · $0.0108 · 1 message on Pro · answered by openai/gpt-6-astra via OpenAI ·
Claude Fable 5.1
Passed: All 7 tests passed.
```javascript function mergeIntervals(intervals) { if (!Array.isArray(intervals) || intervals.length === 0) return []; // Copy so the input (and its inner pairs) is never mutated const sorted = intervals .map(([start, end]) => [start, end]) .sort((a, b) => a[0] - b[0] || a[1] - b[1]); const result = [sorted[0]]; for (let i = 1; i < sorted.length; i++) { const [start, end] = sorted[i]; const last = result[result.length - 1]; if (start <= last[1]) { // Overlapping or touching: extend the current interval if (end > last[1]) last[1] = end; } else { result.push([start, end]); } } return result; } ```621 tokens in, 275 out · 5.3 s · $0.0214 · 1 message on Pro · answered by anthropic/claude-fable-5.1 via Anthropic ·
More coding prompts
The other coding prompts, each with every model's reply, and the results across all five.
Questions
Which AI does best on “Merge overlapping intervals”?
All 16 models passed this coding prompt's check (tests). The cheapest reply that passed was GPT-6 Luna's, at $0.00011; the fastest, GLM 5.3's in 0.8 s. The dearest reply, Claude Fable 5.1's, cost 194 times as much ($0.0214).
What does a reply to “Merge overlapping intervals” cost?
Through the models' APIs, what OpenRouter charged us ran from $0.00011 (GPT-6 Luna) to $0.0214 (Claude Fable 5.1) for this prompt. In llmwise you don't pay by the token: a reply like these counts as one message on Pro, whichever model answers.
Claude, GPT, Gemini, DeepSeek, Grok, Kimi, and GLM, in one chat.
See what a message costs before you send it. Free is 5 messages to try; sign in with an email link, no password or card.