Test Case Problem when n = 0


  • 2

    OJ's test case of n = 0 has a result of [0].

    But I think the result of n = 0 should be [], i.e., an empty list, instead of a list with 0.

    My argument is that, n is the number of bits. If n = 0, it means 0 bits, i.e., no bits!
    What number can have not bits? Even 0 has at list one bit, which is 0.

    If you assume that [0] should be returned when n = 0, then, you mean 0 has no bits.
    Then you need to remove 0 from [0, 1], which is the result when n = 1. This doesn't make sense.

    Anyone agree with me?


  • 0
    R

    I also have the same opinion.


Log in to reply
 

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