add gray code solution.