Answered step by step
Verified Expert Solution
Question
1 Approved Answer
I am using JAVA. and Bob each have an array of integers, namely A and B. A and B have the same size, say n.
I am using JAVA.
and Bob each have an array of integers, namely A and B. A and B have the same size, say n. Alice and ce Bob have come up with a new definition called "weird equality":two arrays A and B are weirdly equal to each other if at least one of the following four conditions is met 1) A- B, meaning that the elements in the corresponding indices are the same If n is divisible by 2, we divide each of the arrays to 2 parts of equal size. So. A will be divided to Ai and A2 (from left to right). Similarly, B is divided to B and B2. Now, the following conditions are checked and if any of them is statisfied we can still say that the arrays are weirdly equal to each other 2) (Ai is weird equal to Bi) AND (A2 is weird equal to B2) 3) LAy is weird equal to Bi) AND (A1 is weird equal to B2) 4) (A2 is weird equal to B2) AND (A2 is weird equal to Bi) Note: if n is not divisble by 2 then conditions 2, 3, and 4 are NOT satisfied At the moment, Alice and Bob are thinking day ahd night to see whether their arrays satisfy the weird equality or not. Write a code for them to determine this and end their pain! Input Format ine has integer 1 3 n 101 Second ine has n integers a t of array A. and the third line has n integers bo, bi,.. . ,n-1 of array B Constraints 0Sa s10 Output Format ENCe iftheir aceinot. This output is casStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started