|
| 1 | +{ |
| 2 | + // Basic problem template for array/string/number problems |
| 3 | + // Copy this structure when creating new basic problems |
| 4 | + |
| 5 | + // REQUIRED: Core identifiers (snake_case for question_name, PascalCase for class_name) |
| 6 | + "question_name": "two_sum", // Snake case from problem title |
| 7 | + "class_name": "TwoSum", // PascalCase version |
| 8 | + "method_name": "two_sum", // Snake case method name |
| 9 | + |
| 10 | + // REQUIRED: Problem metadata (copy directly from LeetCode) |
| 11 | + "problem_number": "1", // String number from URL |
| 12 | + "problem_title": "Two Sum", // Exact title from LeetCode |
| 13 | + "difficulty": "Easy", // Easy|Medium|Hard |
| 14 | + "topics": "Array, Hash Table", // Comma-separated from LeetCode tags |
| 15 | + |
| 16 | + // OPTIONAL: Problem categorization tags |
| 17 | + "tags": ["grind-75"], // Popular lists: grind-75, blind-75, neetcode-150, top-interview |
| 18 | + |
| 19 | + // REQUIRED: Problem description (copy full description from LeetCode) |
| 20 | + "problem_description": "Given an array of integers nums and an integer target, return indices of the two numbers such that they add up to target.", |
| 21 | + |
| 22 | + // REQUIRED: Examples (copy from LeetCode, keep input/output as strings) |
| 23 | + "examples": [ |
| 24 | + { "input": "nums = [2,7,11,15], target = 9", "output": "[0,1]" }, |
| 25 | + { "input": "nums = [3,2,4], target = 6", "output": "[1,2]" }, |
| 26 | + { "input": "nums = [3,3], target = 6", "output": "[0,1]" } |
| 27 | + ], |
| 28 | + |
| 29 | + // REQUIRED: Constraints (copy exactly from LeetCode with \n for line breaks) |
| 30 | + "constraints": "- 2 <= nums.length <= 10^4\n- -10^9 <= nums[i] <= 10^9\n- -10^9 <= target <= 10^9\n- Only one valid answer exists.", |
| 31 | + |
| 32 | + // REQUIRED: Method signature components |
| 33 | + "parameters": "nums: list[int], target: int", // Modern Python type hints |
| 34 | + "return_type": "list[int]", // Return type with modern syntax |
| 35 | + "dummy_return": "[]", // Default return for TODO implementation |
| 36 | + |
| 37 | + // REQUIRED: Import statements (empty for basic problems, specify for TreeNode/ListNode) |
| 38 | + "imports": "", |
| 39 | + |
| 40 | + // REQUIRED: Test configuration |
| 41 | + "test_cases": [ |
| 42 | + { "args": [[2, 7, 11, 15], 9], "expected": [0, 1] }, |
| 43 | + { "args": [[3, 2, 4], 6], "expected": [1, 2] }, |
| 44 | + { "args": [[3, 3], 6], "expected": [0, 1] } |
| 45 | + ], |
| 46 | + |
| 47 | + // REQUIRED: Test method parameters (use expected, not expected_list for basic problems) |
| 48 | + "param_names": "nums, target, expected", |
| 49 | + "param_names_with_types": "nums: list[int], target: int, expected: list[int]", |
| 50 | + |
| 51 | + // REQUIRED: Test setup and logging |
| 52 | + "input_description": "nums={nums}, target={target}", |
| 53 | + "input_params": "nums, target", |
| 54 | + "expected_param": "expected", |
| 55 | + "method_args": "nums, target", |
| 56 | + "test_setup": "", // Empty for basic problems |
| 57 | + "test_logging": "", // Empty for default logging |
| 58 | + "assertion_code": "assert result == expected", |
| 59 | + |
| 60 | + // REQUIRED: Notebook setup |
| 61 | + "test_input_setup": "# Example test case\nnums = [2, 7, 11, 15]\ntarget = 9", |
| 62 | + "expected_output_setup": "expected = [0, 1]" |
| 63 | +} |
0 commit comments