I don't really understand the question


  • 0
    I

    So for:

    ip = "255.0.0.7", n = 10

    Why wouldn't the answer is:

    ["255.0.0.8/29","255.0.0.14/31"]

    I think so because:
    255.0.0.8 = 11111111 00000000 00000000 00001000 => gives 2^3 = 8 addresses
    255.0.0.14 = 11111111 00000000 00000000 00001110 => gives 2^1 = 2 addresses

    => total = 10 addresses


  • 1

    hi invalid:

    your answer ["255.0.0.8/29","255.0.0.14/31"] did not contain the IP 255.0.0.7, though the description of the problem did not mention it explicitly, but the example of the problem implies the answer should contain the start IP:

    Input: ip = "255.0.0.7", n = 10
    Output: ["255.0.0.7/32","255.0.0.8/29","255.0.0.16/32"]
    

  • 0
    M

    @liupangzi
    255.0.0.14 and 255.0.0.15 > 255.0.0.7.
    why this answer is wrong?


  • 0

    @myleetc

    If you mean the answer is as @invalid posted above, the the range of the answer should be [255.0.0.7, 255.0.0.16], which contains exactly 10 IPs and starts from the IP 255.0.0.7, but the answer missed the IP 255.0.0.7.


Log in to reply
 

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