I was solving this problem as a programming exercise:
Given M tiles of $1\times1$ and N tiles of $2\times2$, give an algorithm that returns the (integer) size of the side of the largest possible square that can be built from these tiles.
For example, if $M=8, N=0$ the answer is 2, and if $M=4, N=3$ the answer is 4, etc.
In my solution, I realized that there is a neat way of setting it up as optimization problem:
$$\max_{0\leq x\leq M,0\leq y\leq N}\sqrt{x+4y}$$
And by taking the derivatives we see that there are no extrema inside the domain, hence the max value is on the border, so one combination among $(0,0),~(0, 4N),~(M, 0),~(M, 4N)$ wins and will give the answer (I intentionally omit some additional steps to show that these 4 points are true candidates for maximum/minimum). This gives a nice $\mathcal{O}(1)$ solution.
If we look at a function $z= \sqrt{x+4y}$ on $D=\{(x,y)| 0\leq x\leq M,0\leq y\leq N\}$, can maximum modulus theorem be applied here? Technically, the theorem works for $\mathbb{C}$-valued functions, but its setup does fit into the described problem.