The question I am trying to solve is
$$\begin{array}{ll} \text{extremize} & f(x,y) := xy − 6y − 36x + 216\\ \text{subject to} & y \geq x^2\\ & y \leq 37\end{array}$$
Now I know how to solve these types of questions when the constraints are inequalities on $x$ and $y$, such as $0 \leq x \leq 5$ and $2 \leq y \leq 6$. First, we find the interior critical points and then we find the boundary critical points. Similarly, first, I calculated interior CP and I only got $f(6,36)=0$. Then, I took $x= -\sqrt{37}$ into $f(x,y)$ and got a function of $y$. Then I put in $y=37$ to find the minimum value. It turned out to be correct. The minimum value is $f(-\sqrt{37}, 37) = -12.08$.
But when I take $x=\sqrt{37}$ and $y=37$, value of $f(x,y)$ is $0.08$ and it turns out to be incorrect. I do not know what I am doing wrong and what other values of $x$ or $y$ to take to get another critical point of $f(x,y)$.
Guide:
As you mentioned, the optimal solution can occur in the interior or exterior or on the boundary.
You have computed the critical point for the interior.
Now we can focus on the boundary, an optimal solution need not be at the vertices.
For the $y=37$ boundary, you can first let $y=37$ and $-\sqrt{37} \le x \le \sqrt{37}$ and see where are the optimal points.