ZOAC
From Baekjoon. Grid / Matrix / 2D. Solve the geometry problem "ZOAC".
Examples
Input: [1,2,3]
Output: 0
Input: [2,3,4]
Output: 0
Hints
Recursive divide-and-conquer on string. In range [l, r), find lexicographically smallest character — its position determines output order.
Process right subrange before left subrange. Reason: after fixing smallest char at position k, right side (k+1..r) produces smaller prefixes than left side (l..k-1).
Base case: empty range returns. Mark visited characters; before each recursion call, print current state (visited chars shown at original positions).
ZOAC
**From Baekjoon.** Grid / Matrix / 2D. Solve the geometry problem "ZOAC".