Motivated by applications in option pricing theory (), (Research Report No. 386, Dept. Theoret. Statist. Aarhus, 19 pp.) we formulate and solve the following problem. Given a standard Brownian motion B=(B t ) t > = 0 and a centered probability measure μ on R having the distribution function F with a strictly positive density F' satisfying∫0~xlogxμ(dx)<~,there exists a cost function x c(x) in the optimal stopping problemsupτEmax0=<t=<τB t -∫0τc(B t )dtsuch that for the optimal stopping time τ * we haveB τ * ~μ.The cost function is explicitly given by the formula:c(x)=12F'(x)(1-F(x)),where one incidentally recognizes x F'(x)/(1-F(x)) as the Hazard function of μ. There is also a simple explicit formula for the optimal stopping time τ * , but the main emphasis of the result is on the existence of the underlying functional in the optimal stopping problem. The integrability condition on μ is natural and cannot be improved. The condition on the existence of a strictly positive density is imposed for simplicity, and more general cases could be treated similarly. The method of proof combines ideas and facts on optimal stopping of the maximum process (), (Research Report No. 377, Dept. Theoret. Statist. Aarhas, 30 pp.) and the Azema-Yor solution of the Skorokhod-embedding problem (), (Sem. Probab. XIII, Lecture Notes in Math., vol. 721, Springer, Berlin, pp. 90-115; 625-633). A natural connection between these two theories is established, and new facts of interest for both are displayed. The result extends in a similar form to stochastic integrals with respect to B, as well as to more general diffusions driven by B.