Let B = (B(t))t greater-than-or-equal-to 0 be a standard Brownian motion. For c > 0, k > 0, let T(c, k) = inf{t greater-than-or-equal-to 0: max(s) greater-than-or-equal-to t B(s) - cB(t) greater-than-or-equal-to k}, T* (c, k) = inf{t greater-than-or-equal-to 0: max(s) greater-than-or-equal-to t \B(s)\ - c\B(t)\ greater-than-or-equal-to k}. We show that for c > 0 and k > 0, both T(c, k) and T* (c, k) are finite almost everywhere. Moreover, T(c, k) and T* (c, k) member-of L(p)/2 if and only if c < p/(p - 1) for p > 1, and for all c > 0 when p less-than-or-equal-to 1. These results have analogues for simple random walks. As a consequence, if T is any stopping time of B(t) such that (B(T AND t)t greater-than-or-equal-to 0 is uniformly integrable, then both of the inequalities parallel-to sup(s) less-than-or-equal-to T B(s) parallel-to p less-than-or-equal-to p/p - 1 parallel-to B(T) parallel-to p, parallel-to sup(s) less-than-or-equal-to T\B(s)\ parallel-to p less-than-or-equal-to p/p - 1 parallel-to B(T) parallel-to p, are sharp. This implies that q = p/(p - 1) is not only the best constant for Doob's maximal inequality for general martingales but also for conditionally symmetric martingales (in particular, for dyadic martingales), and for Brownian motion.