|
| 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": { "list": ["grind-75"] }, |
| 9 | + "readme_description": "Given two binary strings `a` and `b`, return *their sum as a binary string*.", |
| 10 | + "_readme_examples": { |
| 11 | + "list": [ |
| 12 | + { "content": "```\nInput: a = \"11\", b = \"1\"\nOutput: \"100\"\n```" }, |
| 13 | + { "content": "```\nInput: a = \"1010\", b = \"1011\"\nOutput: \"10101\"\n```" } |
| 14 | + ] |
| 15 | + }, |
| 16 | + "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.", |
| 17 | + "readme_additional": "", |
| 18 | + "helpers_imports": "", |
| 19 | + "helpers_content": "", |
| 20 | + "helpers_run_name": "add_binary", |
| 21 | + "helpers_run_signature": "(solution_class: type, a: str, b: str)", |
| 22 | + "helpers_run_body": " implementation = solution_class()\n return implementation.add_binary(a, b)", |
| 23 | + "helpers_assert_name": "add_binary", |
| 24 | + "helpers_assert_signature": "(result: str, expected: str) -> bool", |
| 25 | + "helpers_assert_body": " assert result == expected\n return True", |
| 26 | + "solution_imports": "", |
| 27 | + "solution_contents": "", |
| 28 | + "solution_class_content": "", |
| 29 | + "test_imports": "import pytest\nfrom leetcode_py.test_utils import logged_test\nfrom .helpers import assert_add_binary, run_add_binary\nfrom .solution import Solution", |
| 30 | + "test_content": "", |
| 31 | + "test_class_name": "AddBinary", |
| 32 | + "test_class_content": " def setup_method(self):\n self.solution = Solution()", |
| 33 | + "_solution_methods": { |
| 34 | + "list": [ |
| 35 | + { |
| 36 | + "name": "add_binary", |
| 37 | + "signature": "(self, a: str, b: str) -> str", |
| 38 | + "body": " # TODO: Implement add_binary\n return \"\"" |
| 39 | + } |
| 40 | + ] |
| 41 | + }, |
| 42 | + "_test_helper_methods": { |
| 43 | + "list": [{ "name": "setup_method", "parameters": "", "body": "self.solution = Solution()" }] |
| 44 | + }, |
| 45 | + "_test_methods": { |
| 46 | + "list": [ |
| 47 | + { |
| 48 | + "name": "test_add_binary", |
| 49 | + "signature": "(self, a: str, b: str, expected: str)", |
| 50 | + "parametrize": "a, b, expected", |
| 51 | + "test_cases": "[('11', '1', '100'), ('1010', '1011', '10101'), ('0', '0', '0'), ('1', '1', '10'), ('1111', '1111', '11110'), ('1', '0', '1'), ('0', '1', '1'), ('1', '111', '1000'), ('111', '1', '1000'), ('1010', '1', '1011'), ('1111', '1', '10000')]", |
| 52 | + "body": " result = run_add_binary(Solution, a, b)\n assert_add_binary(result, expected)" |
| 53 | + } |
| 54 | + ] |
| 55 | + }, |
| 56 | + "playground_imports": "from helpers import run_add_binary, assert_add_binary\nfrom solution import Solution", |
| 57 | + "playground_setup": "# Example test case\na = '11'\nb = '1'\nexpected = '100'", |
| 58 | + "playground_run": "result = run_add_binary(Solution, a, b)\nresult", |
| 59 | + "playground_assert": "assert_add_binary(result, expected)" |
| 60 | +} |
0 commit comments