Example 4 The permutation of integers $1,2, \cdots, n$ satisfies: each number is greater than all the numbers before it or less than all the numbers before it. How many such permutations are there?
Explanation: The original solution is calculated through a recursive relationship. Let the number sought be $a_{n}$, then
$$
a_{1}=1 \text {. }
$$

For $n>1$, if $n$ is placed in the $i$-th position, then the $n-i$ numbers after it are completely determined, and can only be $n-i, n-i-1$, $\cdots, 2,1$. The $i-1$ numbers before it, $n-i+1, n-i+2, \cdots, n-1$, have $a_{i-1}$ arrangements. Let $i=1,2, \cdots, n$, we get the recursive relationship
$$
\begin{aligned}
a_{n} & =1+a_{1}+\cdots+a_{n-2}+a_{n-1} \\
& =\left(1+a_{1}+\cdots+a_{n-2}\right)+a_{n-1} \\
& =a_{n-1}+a_{n-1} \\
& =2 a_{n-1} .
\end{aligned}
$$

From (1) and (2), we get $a_{n}=2^{n-1}$.
The problem is solved, but both the analysis and the calculation are unnecessarily complicated. Analyzing the solution process, it is clear that the goal is to show that it is a geometric sequence. This is very simple: the last digit has only two arrangements, $n$ or 1. Otherwise, if $k(1<k<n)$ is placed, then there are both numbers larger than $k$, $n$, and numbers smaller than $k$, 1, which does not meet the requirement. Similarly, from back to front, each position has two arrangements, and the last first position has only one arrangement, so,
$$
a_{n}=2^{n-1} \text {. }
$$