🎁 Exclusive Offer! Join our
Telegram Channel
to get **special discounts** and updates! 🚀
Question 33 - 100% Working Solution | Buy Now
Description
9 Live
How to Attempt?
Chocolate Arrangement
Alex loves chocolate a lot. His brother Sam gifts him 2^N boxes of chocolate. These boxes are arranged in 2 rows denoted by 2 arrays A and B both of size N. Each box of chocolate contains some number of chocolates which is represented by A[i] and B[i] (for 1 <= i <= N).
Alex wants the boxes of chocolate in those 2 rows to be arranged in such a way that the boxes containing an equal number of chocolates are placed at the same index i.e. if A[x] and B[y] are equal, then x should be equal to y. You have to help Alex arrange the rows of boxes such that the maximum number of pairs of equal boxes can be placed at the same index, in the manner that Alex wants.
Return the maximum number of pairs of boxes that can be successfully arranged in the manner specified above.
Note: You can rearrange the row only by cyclically shifting the row to the left or to the right. A single cyclic shift to the left is an operation that sets A[0] = A[1], A[1] = A[2], ..., A[N-1] = A[0] simultaneously, and a single