This post is all about the solution of the Prime Reversal Starters 70 (Rated till 6-Stars) codechef problem solution.


Prime Reversal Starters 70 (Rated till 6-Stars) codechef problem solution

Codechef 



AI based Love Calculator



Problem Statement:

You are given two binary strings of length NN, AA and BB. You can execute the following operation on string AA as many times as you want:

XX is a prime number.
Choose any substring of string AA with length XX and reverse it.
Decide whether you can use any (possibly zero) number of steps to make the string AA equal to BB.

A substring is formed by removing some (possibly zero) elements from the string's beginning and some (possibly 0) elements from its end.

Format of Input :

The number of test cases will be indicated by a single integer TT in the first line of input.
Evey test case contains several lines of input.
Each test case's first line contains an integer NN — the duration of the strings AA and BB.
The binary string AA appears on the second line.
The binary string BB appears on the third line.

Format of the Output :

On a new line, output YES if you can start making the string AA equal to BB using any number of operations, and NO else.


Evey character can be printed in either uppercase or lowercase. For example, the letters YES, YES, YES, and YES are all the same.


AI based Love Calculator




Also Check this out:-

Spice Level Starters 70 (Rated till 6-Stars) codechef problem solution, Click Here
Cost of Groceries Starters 70 (Rated till 6-Stars) codechef problem solution, Click Here

Solution of the Problem: Click Here