Tree Traversal Problem

Hey community,
Few days back I gave an online interview, in which I was asked the question(Not same though):

Given a binary tree, find the path between the largest and the smallest node?
Here, the node contains positive integers.

Initially I thought of applying the dfs, followed by finding the max and the min node.

Then the interviewer told me to optimize it. Does anyone has any idea how to optimize it ?

Note: I got rejected in that round, but wanted to know the approach, so asking here.

Can you explain your approach? If your approach is O(V+E), then I am pretty sure it can be proven to be optimal.