← All problemsSign in

B - Pseudo Palindrome

You are given an array $a$ of length $n$ and a non-negative integer $d$. Is it possible to rearrange $a$ in such a way that $|a_i - a_{n + 1 - i}| \le d$ for all $i$ ($1 \le i \le n$)? Here, $|x-y|$ denotes the absolute difference between $x$ and $y$. For example, $|3-1| = 2, |5-9| = 4, |6-6| = 0$. - Time Limit - 2 seconds - Memory Limit - 1.5GB ### Input - The first line of input will conta

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start