Your question is Binary XOR Coding. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
While validating diagnostic bitmasks for a Western Digital WD_BLACK SN850X device, implement binary XOR directly on strings. Return the result once with an iterative algorithm and once with a recursive algorithm, without converting the complete inputs to integers.
Implement binary_xor(a, b, recursive=False):
a and b are non-empty strings containing only '0' and '1'.'0'.recursive is False, use an iterative implementation.recursive is True, use a recursive implementation. The recursive version should avoid one recursive call per bit so it remains practical for long inputs.Do not use Python integer conversion on the complete binary strings, such as int(a, 2).
def binary_xor(a, b, recursive=False):