Optimal Stopping vs Best-of-$N$ for Inference Time Optimization