Added gray code solutin