Given
n. Return a sequence of 2^n numbers in Gray code.Example 1
Input: n = 2
Output: [0,1,3,2]
Explanation: Gray code for n = 2.
Output: [0,1,3,2]
Explanation: Gray code for n = 2.
Example 2
Input: n = 1
Output: [0,1]
Explanation: Gray code for n = 1.
Output: [0,1]
Explanation: Gray code for n = 1.