Numerical approximation of the maximal solutions for a class of degenerate Hamilton-Jacobi equations