Spaces:
Sleeping
Sleeping
| { | |
| "task_id": "medium-2", | |
| "description": "Fix the factorial function with wrong base case", | |
| "buggy_code": "def factorial(n):\n if n == 1:\n return 0\n return n * factorial(n - 1)\n", | |
| "correct_code": "def factorial(n):\n if n == 1:\n return 1\n return n * factorial(n - 1)\n", | |
| "tests": [ | |
| {"input": [1], "expected": 1}, | |
| {"input": [3], "expected": 6}, | |
| {"input": [5], "expected": 120}, | |
| {"input": [4], "expected": 24} | |
| ] | |
| } | |