add perfect solution for gray code problem