Anti-Palindrome Queries
An array $B$ of length $M$ is called an *anti-palindrome* if **no** pair of its opposite elements are equal. That is, $B_i \neq B_{M+1-i}$ should hold for *every* index $1 \leq i \leq M$. For example, $[1, 2]$ and $[1, 2, 3, 2]$ are anti-palindromes, but $[1, 2, 3]$ and $[1, 2, 3, 1]$ are not ($i = 2$ is violated in the first case, $i = 1$ in the second). We say the array $B$ is *beautiful* i
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start