Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.

Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).

n = 0 mean the length is 0, so the program should return [].

Go fix the test case please.

I am thinking about the same thing

Actually, for n = 0, 2^n = 1, so [0] is the correct answer.

n means the lenght, so for n=0, it should return []

the length of |0| is 0, so [0] are all the codes of length 0. [0] is correct, not []

It should not be [0], but [special empty-string symbol]. From wikipedia: "The one-bit Gray code is G1 = (0, 1). This can be thought of as built recursively as above from a zero-bit Gray code G0 = ( Λ ) consisting of a single entry of zero length."

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.