Separation
You are given an array $A = [A_1, A_2, \ldots, A_N]$ of length $N$, as well as an integer $X$. $X$ is said to be *separated* if there exists at least one index $i$ ($1 \le i \lt N$) such that: - $A_i \lt X$ and $A_{i+1} \gt X$, **or** - $A_i \gt X$ and $A_{i+1} \lt X$. That is, $X$ is said to be *separated* if $A$ contains a pair of adjacent elements with one of them being strictly less than $X$
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