= Sorted-coordinate criterion for box containment
{title2=$X\text{ fits }Y\iff a_i<b_i\text{ for all }i$}
Let $a_1\le\cdots\le a_d$ and $b_1\le\cdots\le b_d$ be the separately sorted dimension vectors. Matching corresponding ranks proves the forward construction when every $a_i<b_i$. Conversely, if $a_k\ge b_k$, then the $d-k+1$ source dimensions from rank $k$ onward require distinct targets strictly larger than $a_k$, but only the last $d-k$ target ranks could qualify. The <pigeonhole principle> rules out such a permutation. Strict inequality matters: equal side lengths do not fit under this convention. Sorting and checking gives an $O(d\log d)$ decision <algorithm>.
Back to article page