Given the following string containing only digits, return an array with all possible valid IP address combinations that can be created from the string:
797100113
Note that an octet cannot begin with a '0' unless the number itself is actually 0. For example, '192.168.010.1' is not a valid IP.
In this case, 79.71.00.113 is not valid although it meets the definitions of the rules.
The text Note that an octet cannot begin with a '0' unless the number itself is actually 0 should be changed. Either to have quotes around the second zero, or to specifically rule out strings of length greater than one.
solutions/genip.js: 797100113 solutions/genip.js: ["7.97.100.113","79.7.100.113","79.71.00.113"]
In this case,
79.71.00.113
is not valid although it meets the definitions of the rules.The text
Note that an octet cannot begin with a '0' unless the number itself is actually 0
should be changed. Either to have quotes around the second zero, or to specifically rule out strings of length greater than one.