# Consecutive XOR CodeChef Solution

### We Are Discuss About CODECHEF SOLUTION

Consecutive XOR CodeChef Solution

## Consecutive XOR CodeChef Solution

Chef has two binary strings AA and BB, both having length NN. He can perform the following operation on AA any number of times (possibly zero):

• Select any index ii (1iN1)(1≤i≤N−1) and simultaneously set Ai:=AiAi+1Ai:=Ai⊕Ai+1 and Ai+1:=AiAi+1Ai+1:=Ai⊕Ai+1. Formally, if initially Ai=xAi=x and Ai+1=yAi+1=y then set Ai:=xyAi:=x⊕y and Ai+1:=xyAi+1:=x⊕y

Here,  denotes the bitwise XOR operation.

Chef wants to determine if it is possible to make AA equal to BB by applying the above operation any number of times. Can you help Chef?

### Input Format

• The first line contains a single integer TT — the number of test cases. Then the test cases follow.
• The first line of each test case contains an integer NN — the length of the binary string AA.
• The second line of each test case contains the binary string AA of length NN.
• The third line of each test case contains the binary string BB of length NN.

### Output Format

For each test case, output YES if Chef can make string AA equal to string BB 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, yesyEsYes will be considered identical).

## Consecutive XOR CodeChef Solution

### Constraints

• 1T1051≤T≤105
• 2N1052≤N≤105
• The sum of NN over all test cases does not exceed 21052⋅105

### Sample Input 1

3
2
00
10
3
010
000
4
0011
0100


### Sample Output 1

NO
YES
YES


## Consecutive XOR CodeChef Solution

Test case 11: It can be proven that we can not make AA equal to BB by using the given operation.

Test case 22: We can apply the following operations: 010–––011–––000010_→011_→000.

Test case 33: We can apply the following operations: 001–––10111–––0100001_1→0111_→0100.

## SOLUTION

Yhaa You have done it but next? if YOU Want to Get Others Please Visit Here ScishowEngineer   Then Follow US HERE and Join Telegram.

If You Want To Learn Something New Then Visit Our Official Channel YOUTUBE