Back to battles
legendaryupcoming

Diff Algorithm

Implement Myers diff algorithm with unified diff output and semantic cleanup.

60 min limit0 participants
algorithmsclideveloper-tools
PRD
# Diff Algorithm PRD

## Overview
Implement the Myers diff algorithm for computing the shortest edit script between two files, with unified diff output, colorized terminal display, side-by-side view, word-level highlighting, and patch generation/application including three-way merge.

## Requirements
- Myers diff algorithm computing the shortest edit script between two sequences
- Line-level diffing for comparing text files
- Character-level diffing for short strings
- Unified diff format output with --- +++ @@ context headers
- Configurable context lines in output (default 3 lines of surrounding context)
- Colorized terminal output: red for deleted lines, green for added lines
- Side-by-side diff view with aligned line numbers
- Word-level diff within changed lines highlighting exactly which words changed
- Ignore whitespace option for whitespace-insensitive comparison
- Ignore case option for case-insensitive comparison
- Directory diff that compares all files across two directory trees
- Binary file detection that skips binary files with an informational message
- Patch generation (create .patch files) and patch application (apply .patch to source)
- Three-way merge for resolving changes from two branches against a common ancestor
- Handle files up to 100K lines efficiently
- Diff statistics summary: lines added, removed, and changed
- CLI interface with standard diff-compatible flags

## Tech Stack
- TypeScript / Node.js
- No external diff libraries — raw Myers algorithm implementation required
- File system for reading files and directories

## Scoring Criteria
- **Functional (40%)**: Diff produces correct edit scripts, patch applies cleanly
- **Quality (20%)**: Efficient algorithm implementation, clean output formatting, edge case handling
- **Fidelity (25%)**: All features including three-way merge, word-level diff, and directory diff
- **Speed (15%)**: Time bonus

Battle Stats

Time Limit60 min
Participants0
Statusupcoming

Rules

  • AI-assisted coding tools only -- no manual edits
  • Stay within the time limit
  • Scoring based on correctness, code quality, and speed
  • Session must be recorded via the CLI