Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .amazonq/rules/development-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,7 @@ Each problem has:

- `README.md` - Problem description
- `solution.py` - Implementation with TODO placeholder
- `tests.py` - Parametrized pytest tests
- `test_solution.py` - Parametrized pytest tests
- `helpers.py` - Test helper functions
- `playground.ipynb` - Interactive Jupyter notebook
- `__init__.py` - Empty package file
137 changes: 43 additions & 94 deletions .amazonq/rules/test-case-enhancement.md
Original file line number Diff line number Diff line change
@@ -1,129 +1,78 @@
# Test Case Enhancement Rules

## Assistant Workflow for Adding Comprehensive Test Cases
## Simple Enhancement Workflow

When user requests to enhance test cases for a problem, the assistant will:
When user requests test case enhancement:

### 1. Problem Resolution (Priority Order)
### 1. Problem Resolution

- **FIRST**: Try to resolve from context - check active file path or user-provided problem name
- **SECOND**: If context resolution fails, THEN run `poetry run python .templates/check_test_cases.py --threshold=10 --max=1` to auto-detect 1 problem with <10 test cases
- **LAST**: If both above fail, ask user to explicitly specify problem name
- Use active file context or user-provided problem name
- If unclear, run: `poetry run python .templates/check_test_cases.py --threshold=10 --max=1`

### 2. Test Case Generation
### 2. Enhancement Process

- Read `leetcode/{problem_name}/README.md` for problem understanding
- Analyze existing test cases in `leetcode/{problem_name}/tests.py`
- Generate comprehensive test cases covering:
- **Edge cases**: Empty inputs, single elements, boundary values
- **Corner cases**: Maximum/minimum constraints, special patterns
- **Normal cases**: Typical scenarios with varied complexity
- **Error cases**: Invalid inputs (if applicable)

### 3. Initial Validation

- Run `make p-test PROBLEM={problem_name}` to verify current implementation
- **If errors found**:
- DO NOT update implementation automatically
- Only update test cases if they're incorrect
- If implementation seems wrong, ASK USER first before modifying

### 4. JSON Template Update

- Update corresponding `.templates/leetcode/json/{problem_name}.json`
- Add new test cases to `test_cases` field in proper format
- Maintain existing test structure and naming conventions

### 5. Backup and Regeneration Process

- **Backup**: Move `leetcode/{problem_name}/` to `.cache/leetcode/{problem_name}/`
- **Regenerate**: Run `make p-gen PROBLEM={problem_name} FORCE=1`
- **Lint check**: Run `make p-lint PROBLEM={problem_name}`
- **Iterate**: If lint fails, update JSON and regenerate until passes
```bash
# Simple 4-step process:
# 1. Update JSON template with more test cases (12-15 total)
# 2. Backup original
mv leetcode/{problem_name} .cache/leetcode/{problem_name}
# 3. Regenerate with enhanced tests
make p-gen PROBLEM={problem_name} FORCE=1 && make p-lint PROBLEM={problem_name}
# 4. Restore original solution, keep enhanced tests
cp .cache/leetcode/{problem_name}/solution.py leetcode/{problem_name}/solution.py
```

### 6. Solution Preservation
### 3. Verification

- Copy `solution.py` from backup to newly generated structure
- Run `make p-test PROBLEM={problem_name}` to verify tests pass
- **If tests fail**: Go back to step 4, update JSON, and iterate until passes
- Run `make p-test PROBLEM={problem_name}`
- Fix any incorrect expected values in test cases
- Update JSON template with corrections

### 7. Cleanup and Restore
### 4. Restore Backup

- **CRITICAL**: Remove entire newly generated `leetcode/{problem_name}/` directory
- **CRITICAL**: Restore original structure from `.cache/leetcode/{problem_name}/` backup
- **CRITICAL**: Only THEN copy enhanced `test_solution.py` from generated files to restored structure
- **CRITICAL**: Preserve existing solution class parametrization - if original test had multiple solution classes, restore them
- Verify final state with `make p-test PROBLEM={problem_name}`
- Clean up backup directory after successful verification
```bash
# Copy enhanced test_solution.py to backup
cp leetcode/{problem_name}/test_solution.py .cache/leetcode/{problem_name}/
# Restore all original files (preserves user edits)
rm -rf leetcode/{problem_name}
mv .cache/leetcode/{problem_name} leetcode/{problem_name}
```

## Test Case Quality Standards
## Test Case Standards

### Coverage Requirements

- **Minimum 10 test cases** per problem
- **Edge cases**: 20-30% of total test cases
- **Normal cases**: 50-60% of total test cases
- **Corner cases**: 20-30% of total test cases
- **Minimum 12 test cases** per problem
- **Edge cases**: Empty inputs, single elements, boundary values
- **Corner cases**: Maximum/minimum constraints, duplicates, sorted arrays
- **Normal cases**: Mixed scenarios with varied complexity

### Test Case Categories
### JSON Format

#### Edge Cases

- Empty inputs: `[]`, `""`, `None`
- Single element: `[1]`, `"a"`
- Boundary values: `[0]`, `[1]`, `[-1]`
- Maximum/minimum constraints from problem description

#### Corner Cases

- Duplicate elements: `[1,1,1]`
- Sorted/reverse sorted arrays: `[1,2,3]`, `[3,2,1]`
- All same elements: `[5,5,5,5]`
- Alternating patterns: `[1,0,1,0]`

#### Normal Cases

- Mixed positive/negative numbers
- Various array sizes within constraints
- Different data patterns and structures
- Representative problem scenarios

### JSON Format Requirements

- Use single quotes for Python strings in test cases
- Use single quotes for Python strings: `'hello'` not `"hello"`
- Follow existing parametrize format
- Maintain type hints in parametrize_typed
- Ensure test_cases string is valid Python list syntax
- **NEVER include custom solution classes** in test_imports - only import the main solution class specified in solution_class_name
- **PRESERVE existing solution class parametrization** - if original test had multiple solution classes, restore them after JSON regeneration
- Ensure valid Python list syntax in test_cases field

## Commands Reference
## Quick Commands

```bash
# Find problems needing more test cases
poetry run python .templates/check_test_cases.py --threshold=10 --max=1
# Find problems needing enhancement
poetry run python .templates/check_test_cases.py --threshold=10

# Test specific problem
make p-test PROBLEM={problem_name}

# Generate from JSON template
make p-gen PROBLEM={problem_name} FORCE=1

# Lint specific problem
# Lint check
make p-lint PROBLEM={problem_name}
```

## Error Handling

- **Implementation errors**: Ask user before modifying solution code
- **Test failures**: Update JSON template and regenerate
- **Lint failures**: Fix JSON format and iterate
- **Backup failures**: Ensure `.cache/leetcode/` directory exists

## Success Criteria

- All tests pass with enhanced test cases
- Minimum 10 comprehensive test cases per problem
- Original solution code preserved and working
- Minimum 12 comprehensive test cases per problem
- Original solution code preserved
- **Enhanced test cases in final test_solution.py**
- JSON template updated for future regeneration
- Clean final state with no temporary files
2 changes: 1 addition & 1 deletion .templates/leetcode/json/accounts_merge.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"name": "test_accounts_merge",
"signature": "(self, accounts: list[list[str]], expected: list[list[str]])",
"parametrize": "accounts, expected",
"test_cases": "[([[\"John\", \"johnsmith@mail.com\", \"john_newyork@mail.com\"], [\"John\", \"johnsmith@mail.com\", \"john00@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]], [[\"John\", \"john00@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]]), ([[\"Gabe\", \"Gabe0@m.co\", \"Gabe3@m.co\", \"Gabe1@m.co\"], [\"Kevin\", \"Kevin3@m.co\", \"Kevin5@m.co\", \"Kevin0@m.co\"], [\"Ethan\", \"Ethan5@m.co\", \"Ethan4@m.co\", \"Ethan0@m.co\"], [\"Hanzo\", \"Hanzo3@m.co\", \"Hanzo1@m.co\", \"Hanzo0@m.co\"], [\"Fern\", \"Fern5@m.co\", \"Fern1@m.co\", \"Fern0@m.co\"]], [[\"Ethan\", \"Ethan0@m.co\", \"Ethan4@m.co\", \"Ethan5@m.co\"], [\"Gabe\", \"Gabe0@m.co\", \"Gabe1@m.co\", \"Gabe3@m.co\"], [\"Hanzo\", \"Hanzo0@m.co\", \"Hanzo1@m.co\", \"Hanzo3@m.co\"], [\"Kevin\", \"Kevin0@m.co\", \"Kevin3@m.co\", \"Kevin5@m.co\"], [\"Fern\", \"Fern0@m.co\", \"Fern1@m.co\", \"Fern5@m.co\"]]), ([[\"John\", \"john@mail.com\"]], [[\"John\", \"john@mail.com\"]]), ([[\"John\"]], [[\"John\"]]), ([[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]], [[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]]), ([[\"John\", \"a@mail.com\", \"b@mail.com\"], [\"John\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]], [[\"John\", \"a@mail.com\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]]), ([[\"Alice\", \"alice@mail.com\", \"alice1@mail.com\"], [\"Alice\", \"alice2@mail.com\", \"alice3@mail.com\"], [\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\"]], [[\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\", \"alice3@mail.com\", \"alice@mail.com\"]]), ([[\"John\", \"shared@mail.com\"], [\"Jane\", \"shared@mail.com\"]], [[\"John\", \"shared@mail.com\"]])]",
"test_cases": "[([[\"John\", \"johnsmith@mail.com\", \"john_newyork@mail.com\"], [\"John\", \"johnsmith@mail.com\", \"john00@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]], [[\"John\", \"john00@mail.com\", \"john_newyork@mail.com\", \"johnsmith@mail.com\"], [\"Mary\", \"mary@mail.com\"], [\"John\", \"johnnybravo@mail.com\"]]), ([[\"Gabe\", \"Gabe0@m.co\", \"Gabe3@m.co\", \"Gabe1@m.co\"], [\"Kevin\", \"Kevin3@m.co\", \"Kevin5@m.co\", \"Kevin0@m.co\"], [\"Ethan\", \"Ethan5@m.co\", \"Ethan4@m.co\", \"Ethan0@m.co\"], [\"Hanzo\", \"Hanzo3@m.co\", \"Hanzo1@m.co\", \"Hanzo0@m.co\"], [\"Fern\", \"Fern5@m.co\", \"Fern1@m.co\", \"Fern0@m.co\"]], [[\"Ethan\", \"Ethan0@m.co\", \"Ethan4@m.co\", \"Ethan5@m.co\"], [\"Gabe\", \"Gabe0@m.co\", \"Gabe1@m.co\", \"Gabe3@m.co\"], [\"Hanzo\", \"Hanzo0@m.co\", \"Hanzo1@m.co\", \"Hanzo3@m.co\"], [\"Kevin\", \"Kevin0@m.co\", \"Kevin3@m.co\", \"Kevin5@m.co\"], [\"Fern\", \"Fern0@m.co\", \"Fern1@m.co\", \"Fern5@m.co\"]]), ([[\"John\", \"john@mail.com\"]], [[\"John\", \"john@mail.com\"]]), ([[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]], [[\"John\", \"john1@mail.com\"], [\"John\", \"john2@mail.com\"], [\"John\", \"john3@mail.com\"]]), ([[\"John\", \"a@mail.com\", \"b@mail.com\"], [\"John\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]], [[\"John\", \"a@mail.com\", \"b@mail.com\", \"c@mail.com\"], [\"John\", \"d@mail.com\"]]), ([[\"Alice\", \"alice@mail.com\", \"alice1@mail.com\"], [\"Alice\", \"alice2@mail.com\", \"alice3@mail.com\"], [\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\"]], [[\"Alice\", \"alice1@mail.com\", \"alice2@mail.com\", \"alice3@mail.com\", \"alice@mail.com\"]]), ([[\"Bob\", \"bob@mail.com\"], [\"Bob\", \"bob@mail.com\"]], [[\"Bob\", \"bob@mail.com\"]]), ([[\"David\", \"david1@mail.com\", \"david2@mail.com\"], [\"David\", \"david3@mail.com\"], [\"David\", \"david2@mail.com\", \"david4@mail.com\"]], [[\"David\", \"david1@mail.com\", \"david2@mail.com\", \"david4@mail.com\"], [\"David\", \"david3@mail.com\"]]), ([[\"Alex\", \"alex@mail.com\"], [\"Alex\", \"alex@mail.com\", \"alex2@mail.com\"], [\"Alex\", \"alex3@mail.com\"]], [[\"Alex\", \"alex2@mail.com\", \"alex@mail.com\"], [\"Alex\", \"alex3@mail.com\"]]), ([[\"Tom\", \"tom1@mail.com\"], [\"Tom\", \"tom2@mail.com\"], [\"Tom\", \"tom3@mail.com\"], [\"Tom\", \"tom4@mail.com\"]], [[\"Tom\", \"tom1@mail.com\"], [\"Tom\", \"tom2@mail.com\"], [\"Tom\", \"tom3@mail.com\"], [\"Tom\", \"tom4@mail.com\"]]), ([[\"Sam\", \"sam@mail.com\", \"sam1@mail.com\", \"sam2@mail.com\"]], [[\"Sam\", \"sam@mail.com\", \"sam1@mail.com\", \"sam2@mail.com\"]])]",
"body": " result = run_accounts_merge(Solution, accounts)\n assert_accounts_merge(result, expected)"
}
],
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/balanced_binary_tree.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"name": "test_is_balanced",
"signature": "(self, root_list: list[int | None], expected: bool)",
"parametrize": "root_list, expected",
"test_cases": "[([3, 9, 20, None, None, 15, 7], True), ([1, 2, 2, 3, 3, None, None, 4, 4], False), ([], True), ([1], True), ([1, 2], True), ([1, None, 2], True), ([1, 2, 3, 4], True), ([1, 2, 2, 3, None, None, 3, 4, None, None, 4], False)]",
"test_cases": "[([3, 9, 20, None, None, 15, 7], True), ([1, 2, 2, 3, 3, None, None, 4, 4], False), ([], True), ([1], True), ([1, 2], True), ([1, None, 2], True), ([1, 2, 3, 4], True), ([1, 2, 2, 3, None, None, 3, 4, None, None, 4], False), ([1, 2, 3], True), ([1, 2, None, 3], False), ([1, None, 2, None, 3], False), ([1, 2, 3, 4, 5, 6, 7], True), ([1, 2, 3, None, None, 4, None, None, 5], False), ([5, 1, 4, None, None, 3, 6], True), ([1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, None, None, 5, 5], True)]",
"body": " result = run_is_balanced(Solution, root_list)\n assert_is_balanced(result, expected)"
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"name": "test_max_profit",
"signature": "(self, prices: list[int], expected: int)",
"parametrize": "prices, expected",
"test_cases": "[([7, 1, 5, 3, 6, 4], 5), ([7, 6, 4, 3, 1], 0), ([1, 2, 3, 4, 5], 4), ([5, 4, 3, 2, 1], 0), ([1], 0), ([2, 1], 0), ([1, 2], 1), ([3, 2, 6, 5, 0, 3], 4)]",
"test_cases": "[([7, 1, 5, 3, 6, 4], 5), ([7, 6, 4, 3, 1], 0), ([1, 2, 3, 4, 5], 4), ([5, 4, 3, 2, 1], 0), ([1], 0), ([2, 1], 0), ([1, 2], 1), ([3, 2, 6, 5, 0, 3], 4), ([2, 4, 1], 2), ([1, 5, 3, 6, 4], 5), ([10, 1, 5, 6, 7, 1], 6), ([6, 1, 3, 2, 4, 7], 6), ([1, 4, 2], 3), ([3, 3, 5, 0, 0, 3, 1, 4], 4), ([2, 1, 2, 1, 0, 1, 2], 2)]",
"body": " result = run_max_profit(Solution, prices)\n assert_max_profit(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/binary_tree_right_side_view.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"name": "test_right_side_view",
"signature": "(self, root_list: list[int | None], expected: list[int])",
"parametrize": "root_list, expected",
"test_cases": "[([1, 2, 3, None, 5, None, 4], [1, 3, 4]), ([1, 2, 3, 4, None, None, None, 5], [1, 3, 4, 5]), ([1, None, 3], [1, 3]), ([], []), ([1], [1]), ([1, 2], [1, 2]), ([1, None, 2], [1, 2])]",
"test_cases": "[([1, 2, 3, None, 5, None, 4], [1, 3, 4]), ([1, 2, 3, 4, None, None, None, 5], [1, 3, 4, 5]), ([1, None, 3], [1, 3]), ([], []), ([1], [1]), ([1, 2], [1, 2]), ([1, None, 2], [1, 2]), ([1, 2, 3], [1, 3]), ([1, 2, None, 4], [1, 2, 4]), ([1, 2, 3, 4, 5, 6, 7], [1, 3, 7]), ([1, 2, 3, None, None, 4, 5], [1, 3, 5]), ([5, 4, 6, None, None, None, 7], [5, 6, 7]), ([1, 2, 3, 4, 5, None, None, 8], [1, 3, 5, 8]), ([10, 5, 15, None, 6, 12, 20], [10, 15, 20])]",
"body": " result = run_right_side_view(Solution, root_list)\n assert_right_side_view(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/climbing_stairs.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"name": "test_climb_stairs",
"signature": "(self, n: int, expected: int)",
"parametrize": "n, expected",
"test_cases": "[(1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13), (10, 89), (20, 10946), (45, 1836311903)]",
"test_cases": "[(1, 1), (2, 2), (3, 3), (4, 5), (5, 8), (6, 13), (7, 21), (8, 34), (9, 55), (10, 89), (15, 987), (20, 10946), (25, 121393), (30, 1346269), (35, 14930352), (40, 165580141), (45, 1836311903)]",
"body": " result = run_climb_stairs(Solution, n)\n assert_climb_stairs(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/coin_change.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"name": "test_coin_change",
"signature": "(self, coins: list[int], amount: int, expected: int)",
"parametrize": "coins, amount, expected",
"test_cases": "[([1, 2, 5], 11, 3), ([2], 3, -1), ([1], 0, 0), ([1, 3, 4], 6, 2), ([2, 5, 10, 1], 27, 4), ([5], 3, -1), ([1], 1, 1), ([1, 2], 2, 1), ([186, 419, 83, 408], 6249, 20)]",
"test_cases": "[([1, 2, 5], 11, 3), ([2], 3, -1), ([1], 0, 0), ([1, 3, 4], 6, 2), ([2, 5, 10, 1], 27, 4), ([5], 3, -1), ([1], 1, 1), ([1, 2], 2, 1), ([186, 419, 83, 408], 6249, 20), ([1, 5, 10, 25], 30, 2), ([2, 3, 5], 9, 3), ([1, 4, 5], 8, 2), ([3, 5], 1, -1), ([1, 2, 5], 100, 20), ([7, 11], 14, 2)]",
"body": " result = run_coin_change(Solution, coins, amount)\n assert_coin_change(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/combination_sum.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"name": "test_combination_sum",
"signature": "(self, candidates: list[int], target: int, expected: list[list[int]])",
"parametrize": "candidates, target, expected",
"test_cases": "[([2, 3, 6, 7], 7, [[2, 2, 3], [7]]), ([2, 3, 5], 8, [[2, 2, 2, 2], [2, 3, 3], [3, 5]]), ([2], 1, [])]",
"test_cases": "[([2, 3, 6, 7], 7, [[2, 2, 3], [7]]), ([2, 3, 5], 8, [[2, 2, 2, 2], [2, 3, 3], [3, 5]]), ([2], 1, []), ([2, 3], 1, []), ([3, 5], 3, [[3]]), ([2, 4], 6, [[2, 2, 2], [2, 4]]), ([5], 5, [[5]]), ([2, 3, 4], 6, [[2, 2, 2], [2, 4], [3, 3]]), ([4, 2, 8], 8, [[2, 2, 2, 2], [2, 2, 4], [4, 4], [8]]), ([3, 4, 5], 9, [[3, 3, 3], [4, 5]]), ([6, 3, 2], 6, [[2, 2, 2], [3, 3], [6]]), ([2, 7], 9, [[2, 7]])]",
"body": " result = run_combination_sum(Solution, candidates, target)\n assert_combination_sum(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/container_with_most_water.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"name": "test_max_area",
"signature": "(self, height: list[int], expected: int)",
"parametrize": "height, expected",
"test_cases": "[([1,8,6,2,5,4,8,3,7], 49), ([1,1], 1), ([1,2,1], 2)]",
"test_cases": "[([1,8,6,2,5,4,8,3,7], 49), ([1,1], 1), ([1,2,1], 2), ([2,1], 1), ([1,2,4,3], 4), ([1,3,2,5,25,24,5], 24), ([2,3,4,5,18,17,6], 17), ([1,2,3,4,5], 6), ([5,4,3,2,1], 6), ([0,2], 0), ([3,9,3,4,7,2,12,6], 45), ([1,0,0,0,0,0,0,2,2], 8)]",
"body": " result = run_max_area(Solution, height)\n assert_max_area(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/contains_duplicate.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"name": "test_contains_duplicate",
"signature": "(self, nums: list[int], expected: bool)",
"parametrize": "nums, expected",
"test_cases": "[([1, 2, 3, 1], True), ([1, 2, 3, 4], False), ([1, 1, 1, 3, 3, 4, 3, 2, 4, 2], True)]",
"test_cases": "[([1, 2, 3, 1], True), ([1, 2, 3, 4], False), ([1, 1, 1, 3, 3, 4, 3, 2, 4, 2], True), ([1], False), ([1, 1], True), ([0, 0], True), ([-1, -1], True), ([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], False), ([10, 9, 8, 7, 6, 5, 4, 3, 2, 1], False), ([1, 2, 3, 4, 5, 1], True), ([-1000000000, 1000000000, -1000000000], True), ([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0], True)]",
"body": " result = run_contains_duplicate(Solution, nums)\n assert_contains_duplicate(result, expected)"
}
]
Expand Down
2 changes: 1 addition & 1 deletion .templates/leetcode/json/course_schedule.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"name": "test_can_finish",
"signature": "(self, num_courses: int, prerequisites: list[list[int]], expected: bool)",
"parametrize": "num_courses, prerequisites, expected",
"test_cases": "[(2, [[1, 0]], True), (2, [[1, 0], [0, 1]], False), (1, [], True), (3, [[1, 0], [2, 1]], True), (4, [[1, 0], [2, 1], [3, 2], [1, 3]], False)]",
"test_cases": "[(2, [[1, 0]], True), (2, [[1, 0], [0, 1]], False), (1, [], True), (3, [[1, 0], [2, 1]], True), (4, [[1, 0], [2, 1], [3, 2], [1, 3]], False), (3, [[0, 1], [0, 2], [1, 2]], True), (4, [[0, 1], [1, 2], [2, 3], [3, 1]], False), (6, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 5]], True), (3, [[1, 0], [2, 0]], True), (5, [[0, 1], [1, 2], [2, 3], [3, 4], [4, 0]], False), (4, [[1, 0], [2, 0], [3, 1], [3, 2]], True), (5, [[1, 0], [2, 1], [3, 2], [4, 3], [0, 4]], False)]",
"body": " result = run_can_finish(Solution, num_courses, prerequisites)\n assert_can_finish(result, expected)"
}
]
Expand Down
Loading