[Solution] Consecutive XOR Codechef Solution
Chef has two binary strings and , both having length . He can perform the following operation on any number of times (possibly zero):
- Select any index and simultaneously set and . Formally, if initially and then set and
Here, denotes the bitwise XOR operation.
Chef wants to determine if it is possible to make equal to by applying the above operation any number of
👇👇👇👇👇
times. Can you help Chef?
Input Format
- The first line contains a single integer — the number of test cases. Then the test cases follow.
- The first line of each test case contains an integer — the length of the binary string .
- The second line of each test case contains the binary string of length .
- The third line of each test case contains the binary string of length .
Output Format
For each test case, output YES
if Chef can make string equal to string by applying the above operation any number of times. Otherwise, output NO
.
You may print each character of YES
and NO
in uppercase or lowercase (for example, yes
, yEs
, Yes
will be considered identical).
Constraints
- The sum of over all test cases does not exceed
No comments:
Post a Comment