Artificial intelligent assistant

If a continuous function on $\mathbb{R}$ attains an extremum at a single point, it must be the global extremum. Let $f$ be a continuous function on $\mathbb{R}$ which attains a local maximum at ${{x}_{0}}$. Prove that if $f$ doesn't have any other extremum points, then ${{x}_{0}}$ is the global maximum of $f$ on $\mathbb{R}$. I know this has something to do with Weierstrass's theorem but am unable to formulate a proof. BTW, $f$ is not necessarily differentiable!

Note that if $x_0$ is a local maximum, there is some $B(x_0,r)$ such that $f(x) \le f(x_0)$ in this ball. In fact, we must have $f(x) < f(x_0)$ for all $x \
eq x_0$ in this ball, as otherwise this would contradict the unique extremum assumption.

If there is some point $x_1$ such that $f(x_1) \ge f(x_0)$, then we see that there is a minimizer in $[x_0,x_1]$ with strictly lower value than $f(x_0)$, and this contradicts the unique extremum assumption.

Hence $f(x) < f(x_0)$ for all $x \
eq x_0$.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy c8cbf3efdc71834f811d06469b0dbfdd