package Backtracking;

import java.util.ArrayList;
import java.util.List;

public class GrayCode{
    List<Integer> ret;

    public List<Integer> grayCode(int n) {
        if(n == 0) {
            List<Integer> ret = new ArrayList<>();
            ret.add(0);
            return ret;
        }

        ret = grayCode(n - 1);
        int seqN = 1 << (n - 1);
        for(int i=seqN; i>0; i--)
            ret.add(seqN + ret.get(i-1));
        return ret;
    }
}
@@ -312,32 +312,59 @@
 rayCode(n - 1);%0A
+        // pow(2, n%EF%BC%89 %E7%94%A8%E7%A7%BB%E4%BD%8D%E6%9B%BF%E4%BB%A3%0A
         int seqN
@@ -483,8 +483,9 @@
 %0A    %7D%0A%7D
+%0A

Update GrayCode.java