You are missing the point here. This is an exercise. The intent is for you to find a solution that does not use max or min.
Does sort serve the purpose? (Yes, quite well.)
Does sort do more work than max or min would perform? (Yes.)
Do you care? (No.)
Your goal was not to find some solution that you think to me optimally elegant, was it? The elegant solution is to use max and min, that is, to use the code provided which is maximally on-target. Suppose instead, you found some tool that took an array and directly returns the min and max of the vector? Almost certainly, that tool will just use min and max internally.
Sort is a good solution, and you are overthinking the problem.