In this paper we consider the problem that consists in finding the minimum of the maximum of a scalar functional on a trajectory. We present a Hamilton-Jacobi-Bellman (HJB) equation associated to the optimal cost. The corresponding solution is defined in the viscosity sense and we prove that the optimal cost is the unique solution.