A deterministic approach to optimal stopping with application to a prophet inequality