A solution of the discrete minimum-time control problem