|
| 1 | +{ |
| 2 | + "problem_name": "add_binary", |
| 3 | + "solution_class_name": "Solution", |
| 4 | + "problem_number": "67", |
| 5 | + "problem_title": "Add Binary", |
| 6 | + "difficulty": "Easy", |
| 7 | + "topics": "Math, String, Bit Manipulation, Simulation", |
| 8 | + "tags": ["grind-75"], |
| 9 | + "readme_description": "Given two binary strings `a` and `b`, return *their sum as a binary string*.", |
| 10 | + "readme_examples": [ |
| 11 | + { "content": "```\nInput: a = \"11\", b = \"1\"\nOutput: \"100\"\n```" }, |
| 12 | + { "content": "```\nInput: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n```" } |
| 13 | + ], |
| 14 | + "readme_constraints": "- `1 <= a.length, b.length <= 10^4`\n- `a` and `b` consist only of `'0'` or `'1'` characters.\n- Each string does not contain leading zeros except for the zero itself.", |
| 15 | + "readme_additional": "", |
| 16 | + "solution_imports": "", |
| 17 | + "solution_methods": [ |
| 18 | + { |
| 19 | + "name": "add_binary", |
| 20 | + "parameters": "a: str, b: str", |
| 21 | + "return_type": "str", |
| 22 | + "dummy_return": "\"\"" |
| 23 | + } |
| 24 | + ], |
| 25 | + "test_imports": "import pytest\nfrom leetcode_py.test_utils import logged_test\nfrom .solution import Solution", |
| 26 | + "test_class_name": "AddBinary", |
| 27 | + "test_helper_methods": [ |
| 28 | + { "name": "setup_method", "parameters": "", "body": "self.solution = Solution()" } |
| 29 | + ], |
| 30 | + "test_methods": [ |
| 31 | + { |
| 32 | + "name": "test_add_binary", |
| 33 | + "parametrize": "a, b, expected", |
| 34 | + "parametrize_typed": "a: str, b: str, expected: str", |
| 35 | + "test_cases": "[('11', '1', '100'), ('1010', '1011', '10101'), ('0', '0', '0'), ('1', '1', '10'), ('1111', '1111', '11110')]", |
| 36 | + "body": "result = self.solution.add_binary(a, b)\nassert result == expected" |
| 37 | + } |
| 38 | + ], |
| 39 | + "playground_imports": "from solution import Solution", |
| 40 | + "playground_test_case": "# Example test case\na = '11'\nb = '1'\nexpected = '100'", |
| 41 | + "playground_execution": "result = Solution().add_binary(a, b)\nresult", |
| 42 | + "playground_assertion": "assert result == expected" |
| 43 | +} |
0 commit comments