0 out of 464 challenges solved
Write a Python function `min_swaps(str1: str, str2: str) -> int` that calculates the minimum number of swaps required to convert one binary string into another. A swap is defined as exchanging two characters in the string. If it's not possible to convert the strings, return "Not Possible". #### Requirements: - Both input strings will have the same length. - The strings will only contain the characters '0' and '1'. #### Example Usage: ```python [main.nopy] min_swaps("1101", "1110") # Output: 1 min_swaps("111", "000") # Output: "Not Possible" min_swaps("111", "110") # Output: "Not Possible" ```
def min_swaps(str1: str, str2: str) -> int: """ Calculate the minimum number of swaps required to convert one binary string to another. Args: str1 (str): The initial binary string. str2 (str): The target binary string. Returns: int: The minimum number of swaps required, or "Not Possible" if conversion is not feasible. """ # Placeholder for the solution pass