题目: ##### 代码: public class Solution { public IList<int> GrayCode(int n) { IList<int>lst=new List<int>{0}; int len; for(int i=0;i<n;i++) { len=lst.Count; for(int j=len-1;j>=0;j--) { lst.Add((int)(lst[j]+Math.Pow(2,i))); } } return lst; } } 补充: