All runs
Successrun_balancedAcme Robotics

is_balanced parser — handle all bracket types

Implement `is_balanced(s)` returning True iff every bracket in `s` is matched and properly nested. Supports `()`, `[]`, `{}`. Must pass the 6-case test suite: empty, simple, nested, mixed, mismatched type `([)]`, unmatched close `)(`.

Green winner
Claude Code · score 100 · 6/6 tests
Loop
is_balanced parser
Trigger
manual
Rounds
2 / 3
Critic
claude-opus-4.1
Started
20651d ago

Round 1

Failed1m 4s
Critic notes

Both Claude Code and Codex fail. Claude's count-based logic accepts `([)]`; Codex's stack lacks an empty-stack guard, raising IndexError on `)(`.

Claude Code
42
4/6 tests12.4smajorminor
  • majorbug: Counts opens vs closes only — accepts `([)]` and `({)}`.
  • minorspec: Missing docstring and type-correct return semantics.
OpenAI Codex
38
3/6 tests11.9smajorminor
  • majoredge_case: Unguarded `stack.pop()` raises IndexError on inputs like `)(` — no empty-stack check.
  • minorstyle: Missing type hints and docstring.
Local OSS
60
4/6 tests14.1smajorminor
  • majorperformance: O(n²) string-replace loop times out on long inputs.
  • minorstyle: Lacks type hints and docstring.

Round 2

Success1m 18s
WinnerClaude Code
Critic notes

Claude Code's solution is exemplary: stack + pair table, type hints, docstring. Codex is functionally correct but ships unused imports.

Claude Code
100
6/6 tests13.8sno findings
def is_balanced(s: str) -> bool:
    """Return True iff every bracket in s is matched and properly nested."""
    pairs = {")": "(", "]": "[", "}": "{"}
    stack: list[str] = []
    for ch in s:
        if ch in "([{":
            stack.append(ch)
        elif ch in pairs:
            if not stack or stack.pop() != pairs[ch]:
                return False
    return not stack
OpenAI Codex
95
6/6 tests11.9sminor
  • minorstyle: Unused import `re` (F401).
Local OSS
88
6/6 tests16.4sminor
  • minorstyle: No type hints or docstring; cramped formatting.