Need help in an Array Problem

You are given some binary numbers and their positions on a number line.
A window that has equal number of 1s and 0s in it and the size of this window is the difference between the boundary elements.
You have a magical OR operation, using which you can make any 0, a 1 by ORing it with 1.
Find the maximum possible size of the window.

The first argument contains an integer array, A, representing the positions of the 0s.
The second argument contains an integer array, B, representing the positions of the 1s.

Example Input 1:
A = [1, 5, 10]
B = [2]

Example Output 1:
9

Example Explanation 1:
We can OR the 0 at position 10 and then select all the 1s and 0s.
Endpoints are at 10 and 1, thus the size of the cute window will be 10 - 1 = 9.
Topic archived. No new replies allowed.